我试图在单击按钮时更改图像的可见性,但随后图像消失并将其可见性更改回隐藏。基本上是一个保存图像,让用户知道保存成功。我只想在 xaml 中执行此操作。有什么建议吗?
代码:
<Image x:Name="SavedImage"
Source="/check.ico">
<Image.Resources>
<Style TargetType="Image">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=SaveDocumentsButton, Path=IsPressed}"
Value="True">
<Setter Property="Visibility"
Value="Visible"></Setter>
</DataTrigger>
<Trigger Property="Image.Visibility"
Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard x:Name="saveStoryBoard">
<DoubleAnimation x:Name="z"
BeginTime="0:0:0"
Duration="0:0:3"
From="1.0"
To="0.0"
Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
</Image.Resources>
</Image>
<Button x:Name="SaveDocumentsButton"
Style="{StaticResource SaveButtonWhite}"
Command="{Binding SaveUnitCommand}"
HorizontalAlignment="Right">
</Button>