MyDictionary.xaml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  3. <!--Цвета для кнопки-->
  4. <SolidColorBrush x:Key="Button.Static.Background" Color="WhiteSmoke"/>
  5. <SolidColorBrush x:Key="Button.Static.Border" Color="#FF4CB034"/>
  6. <SolidColorBrush x:Key="Button.MouseOver.Background" Color="LightGray"/>
  7. <SolidColorBrush x:Key="Button.MouseOver.Border" Color="LightGreen"/>
  8. <SolidColorBrush x:Key="Button.Pressed.Background" Color="Transparent"/>
  9. <SolidColorBrush x:Key="Button.Pressed.Border" Color="Black"/>
  10. <SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
  11. <SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
  12. <SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
  13. <!--Основной стиль кнопок-->
  14. <Style x:Key="ButtonStyle" TargetType="{x:Type Button}">
  15. <Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
  16. <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
  17. <Setter Property="Foreground" Value="Black"/>
  18. <Setter Property="BorderThickness" Value="1"/>
  19. <Setter Property="Padding" Value="3"/>
  20. <Setter Property="Margin" Value="5"/>
  21. <Setter Property="FontSize" Value="16"/>
  22. <Setter Property="FontFamily" Value="Calibri"/>
  23. <Setter Property="Height" Value="35"/>
  24. <Setter Property="BorderThickness" Value="3"/>
  25. <Setter Property="Template">
  26. <!--Остальные установки стилей для кнопок-->
  27. <Setter.Value>
  28. <ControlTemplate TargetType="{x:Type Button}">
  29. <!--Закругленная рамка для кнопок-->
  30. <Border x:Name="border"
  31. CornerRadius="5"
  32. Background="{TemplateBinding Background}"
  33. BorderBrush="{TemplateBinding BorderBrush}"
  34. BorderThickness="{TemplateBinding BorderThickness}"
  35. SnapsToDevicePixels="true">
  36. <ContentPresenter x:Name="contentPresenter"
  37. Focusable="False"
  38. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  39. Margin="{TemplateBinding Padding}"
  40. RecognizesAccessKey="True"
  41. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  42. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  43. </Border>
  44. <!--Триггеры для кнопок-->
  45. <ControlTemplate.Triggers>
  46. <!--По умолчанию-->
  47. <Trigger Property="IsDefaulted" Value="true">
  48. <Setter Property="BorderBrush"
  49. TargetName="border"
  50. Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
  51. </Trigger>
  52. <!--При наведении-->
  53. <Trigger Property="IsMouseOver" Value="true">
  54. <Setter Property="Background"
  55. TargetName="border"
  56. Value="{StaticResource Button.MouseOver.Background}"/>
  57. <Setter Property="BorderBrush"
  58. TargetName="border"
  59. Value="{StaticResource Button.MouseOver.Border}"/>
  60. </Trigger>
  61. <!--При нажатии-->
  62. <Trigger Property="IsPressed" Value="true">
  63. <Setter Property="Background"
  64. TargetName="border"
  65. Value="{StaticResource Button.Pressed.Background}"/>
  66. <Setter Property="BorderBrush"
  67. TargetName="border"
  68. Value="{StaticResource Button.Pressed.Border}"/>
  69. </Trigger>
  70. </ControlTemplate.Triggers>
  71. </ControlTemplate>
  72. </Setter.Value>
  73. </Setter>
  74. </Style>
  75. </ResourceDictionary>