inherit a style or find the style programmatically
I have a third party control that I assume gets a style from somewhere. I have an subclass of that control, where I add an event handler. but now when I replace the old control in xaml with my overrided control, the style gets lost. I assume that its disting开发者_运维技巧uishing between the superclass and subclass when it applies the style. How do I tell it that subclasses, like MyButton:ThirdPartyButton, should have the same style as ThirdPartyButton.
Or is there a programmatic way to see the source of the style like
ThirdPartyButton.GetDefaultStyleLocation();
Define a style in the resources which is implicitly applied:
<Style TargetType="{x:Type local:MySubclass}"
BasedOn="{StaticResource {x:Type thirdParty:Control}}"/>
This is necessary since styles are sadly not inherited.
精彩评论