我在toolkit:TimePicker
中使用WPF
作为下面的代码
<toolkit:TimePicker x:Name="datetimeBeginBackup"
Format="Custom"
FormatString="HH:mm:ss"
TextAlignment="Center"
Foreground="#FFFFFF">
<toolkit:TimePicker.Background>
<ImageBrush ImageSource="Resources\backup_date_time_picker_bgr.png"/>
</toolkit:TimePicker.Background>
</toolkit:TimePicker>
禁用datetimeBeginBackup
时,会出现白色背景,但不好。
我想通过图片datetimeBeginBackup
更改"backup_date_time_picker_disable_bgr.png"
的背景,但我不知道该怎么做。
有人可以帮助我吗?
非常感谢,
T&amp; T公司
答案 0 :(得分:1)
您可以通过样式执行此操作:
<toolkit:TimePicker x:Name="datetimeBeginBackup"
Format="Custom"
FormatString="HH:mm:ss"
TextAlignment="Center"
Foreground="#FFFFFF">
<toolkit:TimePicker.Style>
<Style TargetType="toolkit:TimePicker">
<Setter Property="Background">
<ImageBrush ImageSource="Resources\backup_date_time_picker_bgr.png"/>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background">
<ImageBrush ImageSource="Resources\backup_date_time_picker_disable_bgr.png"/>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</toolkit:TimePicker.Style>
</toolkit:TimePicker>