I have created a custom WPF button that has 3 states (normal, clicked, disabled). For each state I have a different image. I use this general button in different places in my project and each time I load a different images using a property in the .CS file.
<Button.Resources>
<ImageSource x:Key="Normal">..\Resources\DefaultNormal.png</ImageSource>
<ImageSource x:Key="Disabled">..\Resources\DefaultDisabled.png</ImageSource>
<ImageSource x:Key="Pressed">..\Resources\DefaultPressed.png</ImageSource>
</Button.Resources>
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Image Name="normal" Source="{DynamicResource Normal}" Stretch="Fill"/>
<Image Name="pressed" Source="{DynamicResource Pressed}" Stretch="Fill" Visibility="Hidden"/>
<Image Name="disabled" Source="{DynamicResource Disabled}" Stretch="Fill" Visibility="Hidden"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="normal" Property="Visibility" Value="Hidden"/>
<Setter TargetName="pressed" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="normal" Property="Visibility" Value="Hidden"/>
<Setter TargetName="disabled" Property="Visibility" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
Now I would like to do the same with the button's text/content but I can't find something similar to ImageSource for text. Is there something like that?, or is there a different way to change the text dynamically?