Styles.xaml 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  3. <Style x:Key="FocusVisual">
  4. <Setter Property="Control.Template">
  5. <Setter.Value>
  6. <ControlTemplate>
  7. <Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
  8. </ControlTemplate>
  9. </Setter.Value>
  10. </Setter>
  11. </Style>
  12. <SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
  13. <SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
  14. <SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
  15. <SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
  16. <SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
  17. <SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
  18. <SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
  19. <SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
  20. <SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
  21. <Style x:Key="ButtonStyleBase" TargetType="{x:Type Button}">
  22. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
  23. <Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
  24. <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
  25. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
  26. <Setter Property="BorderThickness" Value="1"/>
  27. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  28. <Setter Property="VerticalContentAlignment" Value="Center"/>
  29. <Setter Property="Padding" Value="1"/>
  30. <Setter Property="Template">
  31. <Setter.Value>
  32. <ControlTemplate TargetType="{x:Type Button}">
  33. <Border x:Name="border" CornerRadius="15" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
  34. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  35. </Border>
  36. <ControlTemplate.Triggers>
  37. <Trigger Property="IsDefaulted" Value="true">
  38. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
  39. </Trigger>
  40. <Trigger Property="IsMouseOver" Value="true">
  41. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
  42. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
  43. </Trigger>
  44. <Trigger Property="IsPressed" Value="true">
  45. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
  46. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
  47. </Trigger>
  48. <Trigger Property="IsEnabled" Value="false">
  49. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
  50. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
  51. <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
  52. </Trigger>
  53. </ControlTemplate.Triggers>
  54. </ControlTemplate>
  55. </Setter.Value>
  56. </Setter>
  57. </Style>
  58. </ResourceDictionary>