Nerdynosaur
Nerdynosaur

Reputation: 1888

How to change the icon of the WPF datepicker?

I'm doing a wpf application where i have two datepicker inside my application. I want to know is that any quick way(like the way i set my datepicker background) for me to change the calendar icon of the wpf default datepicker?

my datepicker code snippet:

  <DatePicker Name="datefromDP" Width="100" Height="24"Foreground="White" BorderThickness="0"  >
        <DatePicker.Resources>
            <Style TargetType="{x:Type DatePickerTextBox}">
                <Setter Property="Text" Value="Select date" />
                <Setter Property="IsReadOnly" Value="True"/>
                <Setter Property="Background">
                  <Setter.Value>
                    <ImageBrush ImageSource="/BeaconProject;component/B_images/button/loginheader_bg.jpg"/>
                  </Setter.Value>
                </Setter>
            </Style>
        </DatePicker.Resources>
  </DatePicker>

my datepicker:

enter image description here

Upvotes: 6

Views: 15681

Answers (1)

Ramin
Ramin

Reputation: 2133

I think you should Use your own style. see DatePicker Style.

The Icon you are referring to is this part of the style:

<Path HorizontalAlignment="Center" Margin="4,3,4,3" ...
<Ellipse HorizontalAlignment="Center" ...
<Border Grid.ColumnSpan="4" Grid.Row="0" Grid.RowSpan="4" ...

Upvotes: 1

Related Questions