Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Page
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="800" Title="Page1">
- <Canvas>
- <Button Canvas.Top="150" Canvas.Left="200" Click="Button_Click">
- <Button.RenderTransform>
- <RotateTransform x:Name="AnimatedRotateTransform" Angle="0" />
- </Button.RenderTransform>
- <Button.Triggers>
- <EventTrigger RoutedEvent="Loaded">
- <EventTrigger.Actions>
- <BeginStoryboard>
- <Storyboard Timeline.DesiredFrameRate="60">
- <DoubleAnimation
- Storyboard.TargetName="AnimatedRotateTransform"
- Storyboard.TargetProperty="Angle"
- From="-5"
- To="355"
- Duration="0:0:0:2"
- DecelerationRatio="1"
- RepeatBehavior="Forever"/>
- </Storyboard>
- </BeginStoryboard>
- </EventTrigger.Actions>
- </EventTrigger>
- </Button.Triggers>
- <Button.Content>
- <TextBlock FontSize="50">
- Click me!!!
- </TextBlock>
- </Button.Content>
- </Button>
- <x:Code>
- <![CDATA[
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- System.Windows.Media.Animation.DoubleAnimation animation = new System.Windows.Media.Animation.DoubleAnimation();
- animation.From = (sender as Button).ActualHeight;
- animation.To = (sender as Button).ActualHeight + 50;
- animation.Duration = TimeSpan.FromSeconds(1);
- (sender as Button).BeginAnimation(HeightProperty, animation);
- }
- ]]>
- </x:Code>
- </Canvas>
Add Comment
Please, Sign In to add comment