PathButton.xaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <Button x:Class="Venus_Themes.UserControls.PathButton"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:Venus_Themes.UserControls"
  7. mc:Ignorable="d"
  8. Style="{DynamicResource PathButtonStyle}"
  9. d:DesignHeight="450" d:DesignWidth="800">
  10. <Button.Resources>
  11. <Style x:Key="FocusVisual">
  12. <Setter Property="Control.Template">
  13. <Setter.Value>
  14. <ControlTemplate>
  15. <Rectangle Margin="2"
  16. SnapsToDevicePixels="true"
  17. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  18. StrokeDashArray="1 2"
  19. StrokeThickness="1" />
  20. </ControlTemplate>
  21. </Setter.Value>
  22. </Setter>
  23. </Style>
  24. <Style x:Key="PathButtonStyle"
  25. TargetType="{x:Type Button}">
  26. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
  27. <Setter Property="Background" Value="#00000000" />
  28. <Setter Property="BorderBrush" Value="#00000000" />
  29. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
  30. <Setter Property="BorderThickness" Value="0,1,1,1" />
  31. <Setter Property="HorizontalContentAlignment" Value="Center" />
  32. <Setter Property="VerticalContentAlignment" Value="Center" />
  33. <Setter Property="Padding" Value="1" />
  34. <Setter Property="Template">
  35. <Setter.Value>
  36. <ControlTemplate TargetType="{x:Type Button}">
  37. <Border x:Name="border"
  38. Background="{TemplateBinding Background}"
  39. BorderBrush="{TemplateBinding BorderBrush}"
  40. BorderThickness="{TemplateBinding BorderThickness}"
  41. SnapsToDevicePixels="true">
  42. <Path x:Name="Path"
  43. Data="{Binding PathData}"
  44. Fill="{Binding DefaultFillBrush}"
  45. RenderTransformOrigin="0.5,0.5"
  46. Stretch="Uniform" />
  47. </Border>
  48. <ControlTemplate.Triggers>
  49. <Trigger Property="IsDefaulted" Value="True">
  50. <Setter TargetName="Path" Property="Fill" Value="{Binding DefaultFillBrush}" />
  51. </Trigger>
  52. <Trigger Property="IsMouseOver" Value="True">
  53. <Setter TargetName="Path" Property="Fill" Value="{Binding MouseOverBrush}" />
  54. </Trigger>
  55. <Trigger Property="IsPressed" Value="True">
  56. <Setter TargetName="Path" Property="Fill" Value="{Binding IsPressedBrush}" />
  57. </Trigger>
  58. <Trigger Property="IsEnabled" Value="False">
  59. <Setter TargetName="Path" Property="Fill" Value="{Binding IsEnabledBrush}" />
  60. </Trigger>
  61. </ControlTemplate.Triggers>
  62. </ControlTemplate>
  63. </Setter.Value>
  64. </Setter>
  65. </Style>
  66. </Button.Resources>
  67. </Button>