当我的应用程序启动时,我正在使用过渡动画。
<Storyboard x:Key="InTransition">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:05" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:05.5000000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="-72"/>
<SplineDoubleKeyFrame KeyTime="00:00:05" Value="-157"/>
<SplineDoubleKeyFrame KeySpline="0.5,0,0.5,1" KeyTime="00:00:05.5000000" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
如果我将它作为一个开始,这很有效,EventTrigger RoutedEvent="FrameworkElement.Loaded"
但我想将它绑定到我的 viewModel 上名为IsInitialized
. 问题是Windows.Triggers
不允许DataTrigger
。
我怎样才能做到这一点?