I have a user control which defines a number of dependency properties. How do I configure it so that if I add a child user Control to its canvas that theses custom dependency properties are inherited?
One of the features of WPF I like is that you can nest User Controls, for example, offering a pie, or a pie combined with a legend. DP inheritence allows the nested control to inherit properties.
This is not the same as attached properties :-(
Thanks for your feedback - looks like I will have to do what i used to do in WinForms, provide property wrappers.
ColinE
Member
19 Points
17 Posts
Custom dependency property inheritance
Oct 10, 2008 10:33 AM | LINK
Hi All,
I have a user control which defines a number of dependency properties. How do I configure it so that if I add a child user Control to its canvas that theses custom dependency properties are inherited?
Thanks,
Colin E.
Dave Relyea
Participant
1090 Points
252 Posts
Microsoft
Re: Custom dependency property inheritance
Oct 12, 2008 04:26 PM | LINK
I'm not sure exactly what you need, but we don't allow custom DP inheritance. You'd have to implement your own inheritance mechanism (ugh).
Something about your scenaio seems like it is more complicated than it needs to be, but I'd need more details to understand.
http://blogs.msdn.com/devdave
damonpayne
Member
324 Points
82 Posts
Re: Custom dependency property inheritance
Oct 12, 2008 08:52 PM | LINK
ColinE,
Do you really mean inheritance, or are you talking about attached properties, like "Canvas.Top" ?
http://www.damonpayne.com/
ColinE
Member
19 Points
17 Posts
Re: Custom dependency property inheritance
Oct 14, 2008 09:03 AM | LINK
Yep - it really is inheritance that I am after, I have been re-implementing a WPF pie chart I wrote within Silverlight:
http://www.codeproject.com/KB/WPF/PieChartDataBinding.aspx
One of the features of WPF I like is that you can nest User Controls, for example, offering a pie, or a pie combined with a legend. DP inheritence allows the nested control to inherit properties.
This is not the same as attached properties :-(
Thanks for your feedback - looks like I will have to do what i used to do in WinForms, provide property wrappers.
Regards,
Colin E.