http://samples.msdn.microsoft.com/Silverlight/SampleBrowser/index.htm#/
Silverlight Documentation Samples
how to MOVE an Image control with animation
http://www.c-sharpcorner.com/uploadfile/anavijai/silverlight-doubleanimation-example/
Silverlight DoubleAnimation Example
1.
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="SilverlightApplication1.MainPage" mc:Ignorable="d" Height="504.478" Width="940.299"> <Grid x:Name="LayoutRoot" Background="Green"> <Canvas Margin="0,-35,0,35"> <Canvas.Resources> <Storyboard x:Name="storyboard1"> <DoubleAnimation Storyboard.TargetName="image1" Storyboard.TargetProperty="Opacity" From="1.0" To="0.0" Duration="0:0:1" AutoReverse="True" RepeatBehavior="Forever" /> </Storyboard> <Storyboard x:Name="storyboard2"> <DoubleAnimation Storyboard.TargetProperty="(Canvas.Left)" From="50" To="250" Storyboard.TargetName="image1" Duration="0:0:0.5" /> </Storyboard> <Storyboard x:Name="storyboard3"> <DoubleAnimation Storyboard.TargetProperty="(Canvas.Top)" From="50" To="250" Storyboard.TargetName="image1" Duration="0:0:0.5" /> </Storyboard> </Canvas.Resources> <Button x:Name="button1" Content="Generate" HorizontalAlignment="Left" Margin="473,55,0,0" VerticalAlignment="Top" Width="106" Height="56" Click="Button_Click_1"/> <Image x:Name="image1" Source="/res/boss.png" HorizontalAlignment="Left" Height="100" VerticalAlignment="Top" Width="100" Canvas.Left="261" Canvas.Top="285"/> </Canvas> </Grid> </UserControl>
2. in cs code use begin() to call a storyboard
storyboard1.Begin();
时间: 2024-12-29 15:27:38