0
我有一個矩形變換一個矩形的顏色,和我有一個故事板:需要在Windows Phone 7的
<Storyboard x:Key="PressAndHoldColorBar">
<ColorAnimationUsingKeyFrames Duration="0:0:10" FillBehavior="Stop" Storyboard.TargetName="rectWarning" Storyboard.TargetProperty="Fill">
<LinearColorKeyFrame KeyTime="0:0:0" Value="Green" />
<LinearColorKeyFrame KeyTime="0:0:7" Value="Yellow" />
<LinearColorKeyFrame KeyTime="0:0:10" Value="Red" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Rectangle Height="100" HorizontalAlignment="Left" Margin="12,328,0,0" Name="rectWarning" Stroke="Black" StrokeThickness="1" VerticalAlignment="Top" Width="200">
我想這種顏色的變化當按下另一個按鈕出現,所以我想編程調用代碼:
s = (Storyboard)this.Resources["PressAndHoldColorBar"];
s.Begin();
我已經把範圍縮小到Storyboard.TargetName和TargetProperty在第一個片段(我認爲)。我只需要幫助確定如何完成它的工作。