I have created a user cont开发者_JS百科rol in silver-light.
I will use this control in two different applications.
Each application has its own styling rules.
I want user control to adopt styling defined in the respective application.
One approach I found is
1) Define two separate styling template of same key in the App.xaml of both application.
2) Use static resource binding to bind styling to the control.
Is there other approach to do the same.??
If the style does not change within a single application I would define a style like this:
<Style TargetType="MyUserControl />
If it changes per situation/view, apply a resource key and set the style per instance of the control.
精彩评论