Silverlight StoryBoard 动态切换ImageSource
Silverlight StoryBoard 动态切换ImageSource
<StackPanel Grid.Row="1" Orientation="Horizontal"> <Image x:Name="Mouth" Style="{StaticResource ModuleImageStyle}" Source="../Assets/icons/large/1389966495_Messages.png"> <Image.Triggers> <EventTrigger RoutedEvent="StackPanel.Loaded"> <BeginStoryboard> <Storyboard x:Name="SingingAnim" AutoReverse="True" RepeatBehavior="Forever"> <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Mouth" Storyboard.TargetProperty="(Image.Source)"> <DiscreteObjectKeyFrame KeyTime="00:00:01"> <DiscreteObjectKeyFrame.Value> <BitmapImage UriSource="../Assets/icons/large/1389966495_Messages.png" /> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> <DiscreteObjectKeyFrame KeyTime="00:00:02"> <DiscreteObjectKeyFrame.Value> <BitmapImage UriSource="../Assets/icons/large/1389966508_Analytics_one.png" /> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> <DiscreteObjectKeyFrame KeyTime="00:00:03"> <DiscreteObjectKeyFrame.Value> <BitmapImage UriSource="../Assets/icons/large/1389966546_Notes.png" /> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> <DiscreteObjectKeyFrame KeyTime="00:00:04"> <DiscreteObjectKeyFrame.Value> <BitmapImage UriSource="../Assets/icons/large/1389966549_Analytics_two.png" /> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> <DiscreteObjectKeyFrame KeyTime="00:00:05"> <DiscreteObjectKeyFrame.Value> <BitmapImage UriSource="../Assets/icons/large/1389966553_Analytics.png" /> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> </Image.Triggers> </Image> <Rectangle RadiusX="60" RadiusY="60" x:Name="MyAnimatedRectangle" Width="100" Height="100" Fill="LightSeaGreen"> <Rectangle.Triggers> <!-- Animates the rectangle‘s opacity. --> <EventTrigger RoutedEvent="Rectangle.Loaded"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="MyAnimatedRectangle" Storyboard.TargetProperty="Opacity" From="1.0" To="0.0" Duration="0:0:5" AutoReverse="True" RepeatBehavior="Forever" /> </Storyboard> </BeginStoryboard> </EventTrigger> </Rectangle.Triggers> </Rectangle> </StackPanel>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。