I have a simple ControlTemplate for buttons which creates a link-like look and feel for them:
<ControlTemplate x:Key="LinkTemplate" TargetType="{x:Type Button}">
<TextBlock Text="{TemplateBinding Content}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="Blue" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="TextDecorations" Value="Underline" />
<Setter Property="Cursor" Value="Hand" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="Gray" />
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</ControlTemplate>
This works fine, but the problem arises when I want to use ContentStringFormat property to format buttons' contents. Since TextBlock doesn't have ContentStringFormat property I can't use template binding.
I also tried using StringFormat when binding button's content, but it seems to be ignored and original content text is passed to TextBlock in template binding.
I guess I could use value converted and pass ContentStringFormat to it as parameter, but it doesn't feel right.
Is there a way to do this using purely XAML or should I just use value converter?