Permalink
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (41 sloc) 1.45 KB
<!-- <Snippet1> -->
<!-- This example shows how to animate with a storyboard.-->
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.Animation.StoryboardsExample"
WindowTitle="Storyboards Example">
<StackPanel Margin="20">
<!-- <Snippet2> -->
<Rectangle Name="MyRectangle"
Width="100"
Height="100">
<!-- </Snippet2> -->
<Rectangle.Fill>
<!-- <Snippet3> -->
<SolidColorBrush x:Name="MySolidColorBrush" Color="Blue" />
<!-- </Snippet3> -->
</Rectangle.Fill>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseEnter">
<BeginStoryboard>
<Storyboard>
<!-- <Snippet5> -->
<DoubleAnimation
Storyboard.TargetName="MyRectangle"
Storyboard.TargetProperty="Width"
From="100" To="200" Duration="0:0:1" />
<!-- </Snippet5> -->
<!-- <Snippet7> -->
<ColorAnimation
Storyboard.TargetName="MySolidColorBrush"
Storyboard.TargetProperty="Color"
From="Blue" To="Red" Duration="0:0:1" />
<!-- </Snippet7> -->
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
</StackPanel>
</Page>
<!-- </Snippet1> -->