Hi,
I have a WPF user control defined in an application assembly. I'm trying to style the user control based on styles in another (skin or theme) assembly. I don't want the theme/skin assembly which contains the resourcedictionary with all the styles to reference the application assembly. Is there any way of doing this? E.g.
WPFApplication Assembly
MyUserControl.xaml <- WPF user control
Theme Assembly
MyStyles.xaml <- WPF resource dictionary
I assume I can use
<Style x:Key="MyStyle">
<Setter Property="Background" Value="Red" />
</Style>
in the MyStyles.xaml resourcedictionary, and use:
<l:MyUserControl Name="control" Style="{StaticResource MyStyle}" />
in any window that uses MyUserControl.xaml in the WPFApplication assembly
However, I would prefer to target the custom user control in the MyStyles.xaml resourcedictionary:
<Style TargetType="{x:Type l:MyUserControl}" x:Key="MyStyle">
<Setter Property="Background" Value="Red" />
</Style>
Is this possible??