How to change the icon of the WPF datepicker?

99封情书 提交于 2019-12-12 12:33:23

问题


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:


回答1:


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" ...


来源:https://stackoverflow.com/questions/14035379/how-to-change-the-icon-of-the-wpf-datepicker

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!