Guest User

Untitled

a guest
Aug 14th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. Image-Togglebutton Animation
  2. <Button Height="53" HorizontalAlignment="Left" IsEnabled="True" IsHitTestVisible="True" Margin="23,294,0,0" Name="ok_button" VerticalAlignment="Top" Width="128">
  3. <Button.Template>
  4. <ControlTemplate TargetType="{x:Type Button}">
  5. <ControlTemplate.Resources>
  6. <Storyboard x:Key="MouseDownTimeLine">
  7. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Pressed" Storyboard.TargetProperty="Opacity">
  8. <SplineDoubleKeyFrame KeyTime="00:00:00.05" Value="1" />
  9. </DoubleAnimationUsingKeyFrames>
  10. </Storyboard>
  11. <Storyboard x:Key="MouseUpTimeLine">
  12. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Pressed" Storyboard.TargetProperty="Opacity">
  13. <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0" />
  14. </DoubleAnimationUsingKeyFrames>
  15. </Storyboard>
  16. <Storyboard x:Key="MouseEnterTimeLine">
  17. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Hover" Storyboard.TargetProperty="Opacity">
  18. <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1" />
  19. </DoubleAnimationUsingKeyFrames>
  20. </Storyboard>
  21. <Storyboard x:Key="MouseExitTimeLine">
  22. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Hover" Storyboard.TargetProperty="Opacity">
  23. <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0" />
  24. </DoubleAnimationUsingKeyFrames>
  25. </Storyboard>
  26. </ControlTemplate.Resources>
  27. <Grid>
  28. <Image Name="Normal" Source="/Specter;component/Images/ok_btn_n.png" />
  29. <Image Name="Hover" Opacity="0" Source="/Specter;component/Images/ok_btn_h.png" />
  30. <Image Name="Pressed" Opacity="0" Source="/Specter;component/Images/ok_btn_p.png" />
  31. </Grid>
  32. <ControlTemplate.Triggers>
  33. <Trigger Property="ButtonBase.IsPressed" Value="True">
  34. <Trigger.EnterActions>
  35. <BeginStoryboard Storyboard="{StaticResource MouseDownTimeLine}" />
  36. </Trigger.EnterActions>
  37. <Trigger.ExitActions>
  38. <BeginStoryboard Storyboard="{StaticResource MouseUpTimeLine}" />
  39. </Trigger.ExitActions>
  40. </Trigger>
  41. <Trigger Property="UIElement.IsMouseOver" Value="True">
  42. <Trigger.EnterActions>
  43. <BeginStoryboard Storyboard="{StaticResource MouseEnterTimeLine}" />
  44. </Trigger.EnterActions>
  45. <Trigger.ExitActions>
  46. <BeginStoryboard Storyboard="{StaticResource MouseExitTimeLine}" />
  47. </Trigger.ExitActions>
  48. </Trigger>
  49. </ControlTemplate.Triggers>
  50. </ControlTemplate>
  51. </Button.Template>
  52. </Button>
Add Comment
Please, Sign In to add comment