Advertisement
Jmat4119

Mouseove effect xaml

Oct 7th, 2014
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. <Window.Resources>
  2. <Style x:Key="DownButtonStyle" TargetType="{x:Type Button}">
  3. <Setter Property="Margin" Value="5"/>
  4. <Setter Property="Cursor" Value="Hand"/>
  5. <Setter Property="Template">
  6. <Setter.Value>
  7. <ControlTemplate TargetType="{x:Type Button}" >
  8. <Image Source="images\next_active.png" Width="22" Height="11"/>
  9. </ControlTemplate>
  10. </Setter.Value>
  11. </Setter>
  12. </Style>
  13. <Style x:Key="dbokFullWidthTransButtonStyle" TargetType="Button">
  14. <Setter Property="Cursor" Value="Hand"/>
  15. <Setter Property="Template">
  16. <Setter.Value>
  17. <ControlTemplate TargetType="Button">
  18. <Border Name="border" Background="Red">
  19. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Stretch" />
  20. </Border>
  21. <ControlTemplate.Triggers>
  22. <Trigger Property="IsMouseOver" Value="True">
  23. <Setter Property="Background" Value="Transparent">
  24. </Setter>
  25. </Trigger>
  26. </ControlTemplate.Triggers>
  27. </ControlTemplate>
  28. </Setter.Value>
  29. </Setter>
  30. </Style>
  31. <Storyboard x:Key="ShowTopMenues">
  32. <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopMenuArea" Storyboard.TargetProperty="Visibility">
  33. <DiscreteObjectKeyFrame KeyTime="0:0:0.1" Value="{x:Static Visibility.Visible}"/>
  34. </ObjectAnimationUsingKeyFrames>
  35. <DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="TopMenuArea" From="0" To="1" Duration="0:0:0.5"/>
  36. </Storyboard>
  37.  
  38. </Window.Resources>
  39. <StackPanel VerticalAlignment="Top">
  40. <Grid>
  41. <Button Style="{StaticResource ResourceKey=dbokFullWidthTransButtonStyle}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Height="45">
  42. <Button.Triggers>
  43. <EventTrigger RoutedEvent="UIElement.MouseEnter" >
  44. <BeginStoryboard Storyboard="{StaticResource ShowTopMenues}"/>
  45. </EventTrigger>
  46. </Button.Triggers>
  47. <Button Style="{StaticResource ResourceKey=DownButtonStyle}" HorizontalAlignment="Stretch" VerticalAlignment="Center"></Button>
  48. </Button>
  49. <DockPanel Background="#151515" LastChildFill="True" Visibility="Collapsed" Name="TopMenuArea" Height="45">
  50. <Label Foreground="White">Here is content of top area click below buton to hide it </Label>
  51. </DockPanel>
  52. </Grid>
  53. </StackPanel>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement