<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="SpinButton" Height="300" Width="300">
<Grid>
<Button Name="btnSpinMe" Content="Spin Me" Width="150" Height="100">
<Button.RenderTransform>
<RotateTransform x:Name="rotButton" Angle="0" CenterX="75" CenterY="50" />
</Button.RenderTransform>
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard Storyboard.TargetName="rotButton" Storyboard.TargetProperty="(RotateTransform.Angle)">
<DoubleAnimationUsingKeyFrames>
<SplineDoubleKeyFrame KeyTime="0:0:00.0" Value="0.0" />
<SplineDoubleKeyFrame KeyTime="0:0:00.2" Value="30.0" />
<SplineDoubleKeyFrame KeyTime="0:0:00.8" Value="330.0" />
<SplineDoubleKeyFrame KeyTime="0:0:01.0" Value="360.0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
</Grid>
</Window>
|