PathButton.xaml 3.7 KB

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