Property inheritance in WPF/Silverlight?
In WPF and Silverilght, what are the rules for deciding if you inherit properties from the visual, declarative, or logica开发者_运维问答l parent?
I must assume you meant property inheritance, because otherwise the question makes no sense: You don't use class inheritance from your visual/logical parent - you simply have a reference to that parent.
Inherited properties are inherited in the following priority order:
- From the logical parent, if any, otherwise...
- From the visual parent, if any, otherwise...
- From the a control-specific inheritance context (such as a Popup window from a Popup), if any. This is likely to be the object corresponding to the containing tag in XAML (which I assume is what you mean by the "declarative parent.")
If none of these types of parents exist or have the value being inherited, the value is set using styles or defaults.
精彩评论