Silverlight canvas example:
In Silverlight we can do animation using Canvas.Here i'm explain simple example.Just copy paste the following xaml code to your silverlight program,then you can see that scrolling texts.
xaml code:
<Canvas
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Canvas.Triggers>
<EventTrigger RoutedEvent="Canvas.Loaded" >
<BeginStoryboard>
<Storyboard x:Name="animation" Storyboard.TargetProperty="(Canvas.Left)" RepeatBehavior="Forever">
<DoubleAnimation Storyboard.TargetName="ScrollingText" From="0" To="-820" Duration="0:0:10" />
<DoubleAnimation Storyboard.TargetName="ScrollingText2" From="820" To="0" Duration="0:0:10" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Canvas.Triggers>
<TextBlock x:Name="ScrollingText" FontSize="36" Foreground="Green" Text="This is a TextBlock scrolling Text" />
<TextBlock x:Name="ScrollingText2" FontSize="36" Foreground="Green" Text="This is a TextBlock scrolling Text" />
</Canvas>
output:
If you want to Bind DoubleAnimation 'From', 'To' property dynamically:
Comments
Post a Comment