You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
4.9 KiB

  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:bpa="clr-namespace:BPA.UIControl">
  4. <ResourceDictionary.MergedDictionaries>
  5. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/Resources/Default.xaml" />
  6. </ResourceDictionary.MergedDictionaries>
  7. <Style x:Key="RubyerControlMask" TargetType="{x:Type bpa:ControlMask}">
  8. <Setter Property="BorderThickness" Value="0" />
  9. <Setter Property="Background" Value="{DynamicResource Mask}" />
  10. <Setter Property="IsTabStop" Value="False" />
  11. <Setter Property="SnapsToDevicePixels" Value="True" />
  12. <Setter Property="MaskOpacity" Value="0.6" />
  13. <Setter Property="ParentElement" Value="{Binding RelativeSource={RelativeSource AncestorType=UIElement}}" />
  14. <Setter Property="Focusable" Value="True" />
  15. <Setter Property="Template">
  16. <Setter.Value>
  17. <ControlTemplate TargetType="{x:Type bpa:ControlMask}">
  18. <Grid>
  19. <Border x:Name="maskBorder"
  20. BorderThickness="{TemplateBinding BorderThickness}"
  21. CornerRadius="{TemplateBinding CornerRadius}"
  22. Opacity="0">
  23. <Border Background="{TemplateBinding Background}"
  24. BorderThickness="{TemplateBinding BorderThickness}"
  25. CornerRadius="{TemplateBinding CornerRadius}"
  26. Opacity="{TemplateBinding MaskOpacity}" />
  27. </Border>
  28. </Grid>
  29. <ControlTemplate.Triggers>
  30. <DataTrigger Binding="{Binding ParentElement.IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True">
  31. <DataTrigger.EnterActions>
  32. <BeginStoryboard>
  33. <Storyboard>
  34. <DoubleAnimation Storyboard.TargetName="maskBorder"
  35. Storyboard.TargetProperty="Opacity"
  36. To="0.5"
  37. Duration="0:0:0.25" />
  38. </Storyboard>
  39. </BeginStoryboard>
  40. </DataTrigger.EnterActions>
  41. <DataTrigger.ExitActions>
  42. <BeginStoryboard>
  43. <Storyboard>
  44. <DoubleAnimation Storyboard.TargetName="maskBorder"
  45. Storyboard.TargetProperty="Opacity"
  46. To="0"
  47. Duration="0:0:0.25" />
  48. </Storyboard>
  49. </BeginStoryboard>
  50. </DataTrigger.ExitActions>
  51. </DataTrigger>
  52. <Trigger Property="IsActive" Value="True">
  53. <Trigger.EnterActions>
  54. <BeginStoryboard>
  55. <Storyboard>
  56. <DoubleAnimation Storyboard.TargetName="maskBorder"
  57. Storyboard.TargetProperty="Opacity"
  58. To="1"
  59. Duration="0:0:0.25">
  60. <DoubleAnimation.EasingFunction>
  61. <CubicEase EasingMode="EaseOut" />
  62. </DoubleAnimation.EasingFunction>
  63. </DoubleAnimation>
  64. </Storyboard>
  65. </BeginStoryboard>
  66. </Trigger.EnterActions>
  67. <Trigger.ExitActions>
  68. <BeginStoryboard>
  69. <Storyboard>
  70. <DoubleAnimation Storyboard.TargetName="maskBorder"
  71. Storyboard.TargetProperty="Opacity"
  72. Duration="0:0:0.2" />
  73. </Storyboard>
  74. </BeginStoryboard>
  75. </Trigger.ExitActions>
  76. </Trigger>
  77. </ControlTemplate.Triggers>
  78. </ControlTemplate>
  79. </Setter.Value>
  80. </Setter>
  81. </Style>
  82. </ResourceDictionary>