我有一個動畫,通過將它無限旋轉360度(它基本上旋轉)來動畫Canvas
。我想要的是這個動畫在顯示控件時開始,然後在控件隱藏時停止。我想我可以把它與VisualStateManager
聯繫起來。我所看到的進出控制here衰落這可以工作,但我只是不知道如何使用VSM啓動和停止故事板使用VisualStateManager來啓動和停止故事板
<Canvas.Resources>
<Storyboard x:Name="spinnerBoard">
<DoubleAnimation
Storyboard.TargetName="SpinnerRotate"
Storyboard.TargetProperty="Angle"
From="0" To="360" Duration="0:0:01.3"
RepeatBehavior="Forever" />
</Storyboard>
</Canvas.Resources>
<Canvas.RenderTransform>
<RotateTransform x:Name="SpinnerRotate" Angle="0" />
</Canvas.RenderTransform>
例VSM
<VisualState x:Name="Show">
<Storyboard>
<!-- Start the story board here -->
</Storyboard>
</VisualState>
<VisualState x:Name="Hide">
<Storyboard>
<!-- Stop the story board here -->
</Storyboard>
</VisualState>
檢查了這一點:) 也許它可以幫助你一點點;) http://stackoverflow.com/questions/2009880/wpf-stop-storyboard-on-知名度改變 –
這woudl是真棒..但多數民衆贊成WPF不Silverlight ...我似乎無法得到'ControlTemplate.Triggers'工作在silverlight – Chris