如何更改WPF日期选择器的图标? [英] How to change the icon of the WPF datepicker?
本文介绍了如何更改WPF日期选择器的图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在做一个wpf应用程序,其中我的应用程序内部有两个datepicker。我想知道是否有任何快速方法(例如我设置日期选择器背景的方法)让我更改wpf默认日期选择器的日历图标?
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>
我的日期选择器:
推荐答案
<我认为你应该使用自己的风格。请参见 DatePicker样式。
您所指的图标就是样式的一部分:
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" ...
这篇关于如何更改WPF日期选择器的图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文