Once I set the TextBlock Foreground Property then I lost the gray on IsEnable=False on buttons and also lost the gray on ToolTip.
How can I set a the style for TextBlock foreground and not effect the IsEnable=False and ToolTip?
<Style TargetType="TextBlock">
<Setter Property="FontFamily" Value="Segoe UI Semilight" />
<Setter Property="FontSize" Value="11" />
<Setter Property="Margin" Value="4,1,0,1" />
<Setter Property="Foreground" Value="{StaticResource BrushDarkDarkBlue}" />
</Style>
Just place your Foreground
setter in a Trigger
that will only set the value if the IsEnabled
property value is true
:
<Style TargetType="TextBlock">
<Setter Property="FontFamily" Value="Segoe UI Semilight" />
<Setter Property="FontSize" Value="11" />
<Setter Property="Margin" Value="4,1,0,1" />
<Style.Triggers>
<Trigger Property="IsEnabled" Value="True">
<Setter Property="Foreground" Value="{StaticResource BrushDarkDarkBlue}" />
</Trigger>
</Style.Triggers>
</Style>
When IsEnabled
turns to false
, the default (template / style) value will be set keeping this "graying out" effect.