Is there a way 开发者_JAVA技巧to apply styles (specifically style data triggers) to a UserControl
within it's own XAML code?
You cannot access a Style in xaml within the UserControl's resources - you have a few options tho:
- Set it in coding in the constructor through
Style = FindResource(<name>) as Style
- Set it in the Parent control
<local:MyUserControl Style="{StaticResource MyStyle}"
- Put the style in any Visual control's Resources-property 'up-the-chain' with an empty key and TargetType="{x:Type MyUserControl}"
Hope this helps.
精彩评论