Cannot figure out how to change text styles when text changes. I set it so that the styles change when I print, and the default is gray to indicate what needs to be done in this field. I want the text to be black and have a normal font weight when it changes from the default text and remains so.
Here are my current style styles
<Style TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="DimGray" />
<Setter Property="FontSize" Value="15" />
<Setter Property="FontStyle" Value="Italic" />
<Setter Property="Padding" Value="5,4,0,4" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBoxBase}">
<Border
x:Name="Bd"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="7"
>
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="2,1">
<GradientStop Color="{Binding Path=GradientColorStart}" Offset="0"/>
<GradientStop Color="{Binding Path=GradientColorEnd}" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<ScrollViewer x:Name="PART_ContentHost"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter
Property="Background"
TargetName="Bd"
Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"
/>
<Setter Property="Foreground" Value="Green"/>
</Trigger>
<Trigger Property="Width" Value="Auto">
<Setter Property="MinWidth" Value="100"/>
</Trigger>
<Trigger Property="Height" Value="Auto">
<Setter Property="MinHeight" Value="20"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Foreground" Value="Black" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontStyle" Value="Normal" />
<Setter Property="Text" Value="" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="#00112d" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontStyle" Value="Normal" />
</Trigger>
</Style.Triggers>
</Style>
source
share