0
我已經定義了幾個VisualStates
爲我創造了一個覆蓋(「ThankYouOverlay」)的消息褪色控制:無法更改VisualStateManager過渡期
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition To="ThankYou" GeneratedDuration="0:0:0.3">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ThankYouOverlay" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Storyboard.TargetName="ThankYouOverlay" Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ThankYouOverlay" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Storyboard.TargetName="ThankYouOverlay" Storyboard.TargetProperty="(UIElement.Opacity)" To="0"/>
</Storyboard>
</VisualState>
<VisualState x:Name="ThankYou">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ThankYouOverlay" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Storyboard.TargetName="ThankYouOverlay" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
這種轉變的工作,但我無法更改動畫持續時間。我玩過VisualTransition
的GeneratedDuration
屬性和個人動畫「Duration
」屬性的不同組合,但不管這些更改如何,動畫的實際持續時間爲1秒(默認情況下,我假設)。
我錯過了什麼?我如何更改轉換的持續時間?
您的VisualTransition生成的持續時間僅處理從一個狀態移動到另一個狀態所需的時間。但是,故事板上的持續時間將適用於該實際動畫。 – 2014-11-04 15:26:48