我正在嘗試動畫主窗口,更改寬度和高度。我在主窗口樣式中使用DataTrigger來更改它,但是當我運行它時,首先觸發寬度更改,然後更改高度,我希望它們都同時更改。WPF故事板沒有並行運行動畫
<Storyboard x:Key="TransitToExecution">
<!-- This animation hides the main panel -->
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Duration="0:0:0.5">
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="{StaticResource ScreenHeight}"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Duration="0:0:0.5">
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="{StaticResource ScreenWidth}"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
數據觸發很簡單:
<Window.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding IsWideScreen}" Value="true" >
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource TransitToExecution}"/>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Window.Style>
任何想法,爲什麼這兩個動畫不simultaneuosly運行?
感謝
您是否嘗試過交換動畫以查看效果是否獨立於您正在動畫的屬性? – ChrisF 2010-08-27 11:49:40
無論我先放哪個都運行良好,第二個只要突然間就會突然出現。我想知道是否與寬度和高度有關,不能設置在一起 – 2010-08-27 11:52:04