Search code examples
c#wpfxamldatepickermaterial-design-in-xaml

Change date color from a material DataPicker in WPF


I´m a little new using WPF, and i´m implementing the MaterialDesing library. I want to change the color of certain propierties of a DataPicker but cannot find where to do that. Specially the container that has the year, day and month (the one that is in blue)

DatePicker


Solution

  • You could override the PrimaryHueMidBrush resource:

    <DatePicker>
        <DatePicker.CalendarStyle>
            <Style TargetType="Calendar" BasedOn="{StaticResource MaterialDesignCalendarPortrait}">
                <Style.Resources>
                    <SolidColorBrush x:Key="PrimaryHueMidBrush" Color="Red" />
                </Style.Resources>
            </Style>
        </DatePicker.CalendarStyle>
    </DatePicker>