我对我的代码有一个小问题:
<Style TargetType="{x:Type Grid}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Status.IsObjectSaving}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
<Trigger Property="Visibility" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty = "Opacity"
From ="1"
To = "0"
BeginTime = "0:0:0"
Duration = "0:0:2" />
<ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty = "Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:2"
Value="{x:Static Visibility.Collapsed}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
当我的对象将被保存时,应该打开网格并显示一些信息。当我第一次启动程序时它可以工作,但第二次它不起作用。所以我希望你能帮助我。
谢谢丹尼尔
ps 对不起我糟糕的英语!
谢谢回答!我尝试使用以下代码设置值:
<DataTrigger Binding="{Binding Status.IsObjectSaving}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty = "Opacity"
From = "0"
To = "1"
BeginTime = "0:0:0"
Duration = "0:0:2" />
<ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty = "Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:2"
Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty = "Opacity"
From = "1"
To = "0"
BeginTime = "0:0:2"
Duration = "0:0:2" />
<ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty = "Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:2"
Value="{x:Static Visibility.Collapsed}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
但它不起作用。那么你能帮我以正确的方式修改代码吗?
谢谢
丹尼尔