HelperText Color Change XAML Material Design

38 Views Asked by At

How can I change the color of HelperText to Red? Changing the color of HintAssist. Foreground just changes the color of Hint, it does not change the color of HelperText.

<DatePicker Margin="10"
            materialDesign:HintAssist.Hint="Leave From"
            materialDesign:HintAssist.HelperText="{Binding ValidationMessage}"
            SelectedDate="{Binding LeaveFrom, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
            Style="{StaticResource MaterialDesignFloatingHintDatePicker}" />
1

There are 1 best solutions below

1
Bayan On

you can try:

<DatePicker.Resources>
    <Style TargetType="TextBlock" BasedOn="{StaticResource RedHelperTextStyle}"
           x:Key="{x:Static materialDesign:HintAssist.HelperTextProperty}" />
</DatePicker.Resources>

and add this reference :

<Window.Resources>
<Style x:Key="RedHelperTextStyle" TargetType="TextBlock">
    <Setter Property="Foreground" Value="Red" />
</Style>

</Window.Resources>