码迷,mamicode.com
首页 > Web开发 > 详细

Silverlight StoryBoard 动态切换ImageSource

时间:2015-01-20 11:46:59      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

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>

 

Silverlight StoryBoard 动态切换ImageSource

标签:

原文地址:http://www.cnblogs.com/dzone/p/4235542.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!