2
枚举数据触发更改图像
我有一个带有固定背景图像的按钮,并想在其顶部显示一个小的覆盖图像。选择哪个覆盖图像取决于LapCounterPingStatus相应视图模型的依赖项属性()。 这是我到目前为止所得到的: <Button> <Grid> <Image Stretch="None"> <!-- Background Image --> <Image.Style> <Style TargetType="{x:Type Image}"> <Setter Property="Source" Value="/Images/Pingn.png"/> </Style> </Image.Style> </Image> <Image Stretch="None" Panel.ZIndex="1"> <!-- Small Overlay Image --> <Image.Style> <Style TargetType="{x:Type Image}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=LapCounterPingStatus}" Value="PingStatus.PING_UNKNOWN"> <Setter Property="Source" Value="/Images/RefreshOverlayn.png"/> </DataTrigger> <DataTrigger Binding="{Binding Path=LapCounterPingStatus}" Value="PingStatus.PING_FAILURE"> <Setter Property="Source" Value="/Images/ErrorOverlayn.png"/> </DataTrigger> <DataTrigger …