【发布时间】:2013-04-23 11:25:37
【问题描述】:
我有这个 XAML 代码:
<Button x:Name="ButtonUpdate" IsEnabled="False">
<Image Source="Images/update gray.png" Name="ImgUpdate" >
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="True">
<Setter Property="Source" Value="Images/update.png" />
</Trigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</Button>
我希望在启用ButtonUpdate 时:
ButtonUpdate.IsEnabled = true;
ImgUpdate.Source 变为 "Images/update.png",并且当 ButtonUpdate 未启用时:
ButtonUpdate.IsEnabled = false;
使用数据绑定将ImgUpdate.Source 变为"Images/update gray.png"。
我的 XAML 代码不起作用。错误在哪里?我该如何解决?
【问题讨论】: