Solution: UserControl is not the actual type, so I cannot use Implicit Styles on usercontrols. Thanks Tim.
The following Implicit Style does not seem to do anything.
<Style TargetType="UserControl">
<Setter Property="FontFamily" Value="Webdings"/>
<Setter Property="Foreground" Value="Red"/>
</Style>
I know styles are getting loaded into the Apps resource dictionary because if I explicitly set another style in the same .xaml file it will work just fine.
Example:
<Style TargetType="Control" x:Key="BaseStyle">
<Setter Property="FontFamily" Value="Webdings"/>
</Style>
Works fine if I put Style=”{StaticResource BaseStyle}” in the tag.
Thanks
-Shane
You need to specify the actual type of your control instead of just using UserControl. Implicit styles will only work with the specific type. So instead of:
you’d use:
where
myis declared as your namespace andMyUserControlis the actual class name for your UserControl-derived controls.