Posted By

pureequal on 08/26/08


Tagged

animation WPF


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


WPF Animation


 / Published in: C#
 

  1. <Window x:Class="WpfApplication1.Window1"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. Title="Window1" Height="300" Width="562">
  5. <Window.Resources>
  6. <Style x:Key="widthAnim" TargetType="{x:Type Button}">
  7. <Style.Triggers>
  8. <EventTrigger RoutedEvent="Button.Click">
  9. <BeginStoryboard>
  10. <Storyboard Duration="00:05">
  11. <DoubleAnimation AutoReverse="True"
  12. Storyboard.TargetProperty="Width" From="100" To="300" />
  13. <ColorAnimation AutoReverse="True"
  14. Storyboard.TargetProperty="(Control.Background).(SolidColorBrush.Color)" To="Red" />
  15. <DoubleAnimation AutoReverse="True" Storyboard.TargetProperty="FontSize" To="24" />
  16. </Storyboard>
  17. </BeginStoryboard>
  18. </EventTrigger>
  19. </Style.Triggers>
  20. </Style>
  21. </Window.Resources>
  22. <Grid>
  23. <Button Margin="37,129,30,84" Name="button1" Width="100" Style="{StaticResource widthAnim}">Button</Button>
  24. </Grid>
  25. </Window>

Report this snippet  

You need to login to post a comment.