Reputation: 427
For example, we have TextBlock
control, how can I add to it my own property, it's may looks like
<TextBlock MyProperty="666"/>
Thanks!
Upvotes: 0
Views: 40
Reputation: 292765
You can use an attached property, that's exactly what they're here for.
The code won't look exactly as in your example, though, but rather like this:
<TextBlock my:MyClass.MyProperty="666"></TextBlock>
(my
is the XML namespace prefix for the namespace where MyClass
is declared)
Upvotes: 1