Can i change DatePicker's TextBox underline and calender icon color?
like below :
<DatePicker materialDesign:HintAssist.Hint="Start Date" Margin="0,25,0,0"
materialDesign:TextFieldAssist.UnderlineBrush="{StaticResource MainThemeColor3}">
<DatePicker.CalendarStyle>
<Style TargetType="Calendar" BasedOn="{StaticResource MaterialDesignCalendarPortrait}">
<Style.Resources>
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="{StaticResource secondaryBackColor1}"/>
<SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="{StaticResource secondaryBackColor2}"/>
</Style.Resources>
</Style>
</DatePicker.CalendarStyle>
</DatePicker>
I tried like this but this can only change the color after clicked and focused one.
You can see that the icon's color still hasn't changed.
How can i change it?
You should override the PrimaryHueMidBrush
for the DatePicker
to change the colour of the icon:
<DatePicker materialDesign:HintAssist.Hint="Start Date" Margin="0,25,0,0"
materialDesign:TextFieldAssist.UnderlineBrush="{StaticResource MainThemeColor3}">
<DatePicker.Resources>
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="Red" />
</DatePicker.Resources>
<DatePicker.CalendarStyle>
<Style TargetType="Calendar" BasedOn="{StaticResource MaterialDesignCalendarPortrait}">
<Style.Resources>
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="{StaticResource secondaryBackColor1}"/>
<SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="{StaticResource secondaryBackColor2}"/>
</Style.Resources>
</Style>
</DatePicker.CalendarStyle>
</DatePicker>