StyleButton.xaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  3. <!-- // Базовая кнопка //-->
  4. <Style TargetType="Button">
  5. <Style.Setters>
  6. <Setter Property="Background" Value="#498C51"/>
  7. <Setter Property="Foreground" Value="White"/>
  8. <Setter Property="FontSize" Value="14"/>
  9. <Setter Property="Width" Value="150"/>
  10. <Setter Property="BorderThickness" Value="0"/>
  11. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  12. <Setter Property="VerticalContentAlignment" Value="Center"/>
  13. <Setter Property="Cursor" Value="Hand"/>
  14. <Setter Property="Padding" Value="10 5"/>
  15. <Setter Property="Template">
  16. <Setter.Value>
  17. <ControlTemplate TargetType="{x:Type Button}">
  18. <Border
  19. CornerRadius="5"
  20. BorderBrush="{TemplateBinding BorderBrush}"
  21. BorderThickness="{TemplateBinding BorderThickness}"
  22. TextBlock.Foreground="{TemplateBinding Foreground}"
  23. Background="{TemplateBinding Background}"
  24. SnapsToDevicePixels="true">
  25. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  26. Margin="{TemplateBinding Padding}"
  27. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  28. Content="{TemplateBinding Content}"/>
  29. </Border>
  30. </ControlTemplate>
  31. </Setter.Value>
  32. </Setter>
  33. </Style.Setters>
  34. <Style.Triggers>
  35. <Trigger Property="IsMouseOver" Value="true">
  36. <Setter Property="Background" Value="#59A862"/>
  37. </Trigger>
  38. <Trigger Property="IsPressed" Value="true">
  39. <Setter Property="Background" Value="#59A862"/>
  40. <Setter Property="Cursor" Value="AppStarting"/>
  41. </Trigger>
  42. <Trigger Property="IsEnabled" Value="false">
  43. <Setter Property="Background" Value="#C8E2CB"/>
  44. <Setter Property="TextBlock.Foreground" Value="#498C51"/>
  45. </Trigger>
  46. </Style.Triggers>
  47. </Style>
  48. <!--// Кнопка без фона //-->
  49. <Style x:Key="WithoutBackground" TargetType="Button">
  50. <Style.Setters>
  51. <Setter Property="Background" Value="Transparent"/>
  52. <Setter Property="Foreground" Value="#498C51"/>
  53. <Setter Property="FontSize" Value="14"/>
  54. <Setter Property="BorderThickness" Value="0"/>
  55. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  56. <Setter Property="VerticalContentAlignment" Value="Center"/>
  57. <Setter Property="Cursor" Value="Hand"/>
  58. <Setter Property="Padding" Value="10 5"/>
  59. <Setter Property="Template">
  60. <Setter.Value>
  61. <ControlTemplate TargetType="{x:Type Button}">
  62. <Border
  63. BorderBrush="{TemplateBinding BorderBrush}"
  64. BorderThickness="{TemplateBinding BorderThickness}"
  65. TextBlock.Foreground="{TemplateBinding Foreground}"
  66. Background="Transparent"
  67. SnapsToDevicePixels="true">
  68. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  69. Margin="{TemplateBinding Padding}"
  70. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  71. Content="{TemplateBinding Content}"/>
  72. </Border>
  73. </ControlTemplate>
  74. </Setter.Value>
  75. </Setter>
  76. </Style.Setters>
  77. <Style.Triggers>
  78. <Trigger Property="IsMouseOver" Value="true">
  79. <Setter Property="Foreground" Value="Black"/>
  80. </Trigger>
  81. <Trigger Property="IsPressed" Value="true">
  82. <Setter Property="Foreground" Value="Black"/>
  83. <Setter Property="Cursor" Value="AppStarting"/>
  84. </Trigger>
  85. <Trigger Property="IsEnabled" Value="false">
  86. <Setter Property="TextBlock.Foreground" Value="LightGray"/>
  87. </Trigger>
  88. </Style.Triggers>
  89. </Style>
  90. <!--// Кнопка перзагрузки //-->
  91. <ImageBrush x:Key="ic_reset_green" ImageSource="/Assets/icon/reset_green.png"/>
  92. <ImageBrush x:Key="ic_reset_white" ImageSource="/Assets/icon/reset_white.png"/>
  93. <Style x:Key="Restart" TargetType="Button">
  94. <Setter Property="Height" Value="30"/>
  95. <Setter Property="Width" Value="30"/>
  96. <Setter Property="HorizontalAlignment" Value="Center"/>
  97. <Setter Property="VerticalAlignment" Value="Center"/>
  98. <Setter Property="Cursor" Value="Hand"/>
  99. <Setter Property="Template">
  100. <Setter.Value>
  101. <ControlTemplate TargetType="{x:Type Button}">
  102. <Border x:Name="border"
  103. BorderThickness="0"
  104. Background="{StaticResource ic_reset_green}"/>
  105. <ControlTemplate.Triggers>
  106. <Trigger Property="IsMouseOver" Value="True">
  107. <Setter Property="Background" TargetName="border" Value="{StaticResource ic_reset_white}"/>
  108. </Trigger>
  109. <Trigger Property="IsPressed" Value="True">
  110. <Setter Property="Background" TargetName="border" Value="{StaticResource ic_reset_white}"/>
  111. </Trigger>
  112. </ControlTemplate.Triggers>
  113. </ControlTemplate>
  114. </Setter.Value>
  115. </Setter>
  116. </Style>
  117. <!--// Кнопка удаления //-->
  118. <ImageBrush x:Key="ic_close_green" ImageSource="/Assets/icon/close_green.png"/>
  119. <ImageBrush x:Key="ic_close_green_light" ImageSource="/Assets/icon/close_green_light.png"/>
  120. <Style x:Key="Close" TargetType="Button">
  121. <Setter Property="Height" Value="15"/>
  122. <Setter Property="Width" Value="15"/>
  123. <Setter Property="HorizontalAlignment" Value="Right"/>
  124. <Setter Property="VerticalAlignment" Value="Top"/>
  125. <Setter Property="Cursor" Value="Hand"/>
  126. <Setter Property="Margin" Value="10"/>
  127. <Setter Property="Template">
  128. <Setter.Value>
  129. <ControlTemplate TargetType="{x:Type Button}">
  130. <Border x:Name="border"
  131. BorderThickness="0"
  132. Background="{StaticResource ic_close_green}"/>
  133. <ControlTemplate.Triggers>
  134. <Trigger Property="IsMouseOver" Value="True">
  135. <Setter Property="Background" TargetName="border" Value="{StaticResource ic_close_green_light}"/>
  136. </Trigger>
  137. <Trigger Property="IsPressed" Value="True">
  138. <Setter Property="Background" TargetName="border" Value="{StaticResource ic_close_green_light}"/>
  139. </Trigger>
  140. </ControlTemplate.Triggers>
  141. </ControlTemplate>
  142. </Setter.Value>
  143. </Setter>
  144. </Style>
  145. <!-- // Базовая маленькая кнопка //-->
  146. <Style x:Key="MinWith" TargetType="Button">
  147. <Style.Setters>
  148. <Setter Property="Background" Value="White"/>
  149. <Setter Property="Foreground" Value="#498C51"/>
  150. <Setter Property="FontSize" Value="14"/>
  151. <Setter Property="MinWidth" Value="30"/>
  152. <Setter Property="BorderThickness" Value="1"/>
  153. <Setter Property="BorderBrush" Value="#498C51"/>
  154. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  155. <Setter Property="VerticalContentAlignment" Value="Center"/>
  156. <Setter Property="Cursor" Value="Hand"/>
  157. <Setter Property="Padding" Value="10 5"/>
  158. <Setter Property="Margin" Value="5 0"/>
  159. <Setter Property="Template">
  160. <Setter.Value>
  161. <ControlTemplate TargetType="{x:Type Button}">
  162. <Border
  163. CornerRadius="5"
  164. BorderBrush="{TemplateBinding BorderBrush}"
  165. BorderThickness="{TemplateBinding BorderThickness}"
  166. TextBlock.Foreground="{TemplateBinding Foreground}"
  167. Background="{TemplateBinding Background}"
  168. SnapsToDevicePixels="true">
  169. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  170. Margin="{TemplateBinding Padding}"
  171. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  172. Content="{TemplateBinding Content}"/>
  173. </Border>
  174. </ControlTemplate>
  175. </Setter.Value>
  176. </Setter>
  177. </Style.Setters>
  178. <Style.Triggers>
  179. <Trigger Property="IsMouseOver" Value="true">
  180. <Setter Property="Background" Value="#59A862"/>
  181. <Setter Property="Foreground" Value="White"/>
  182. </Trigger>
  183. <Trigger Property="IsPressed" Value="true">
  184. <Setter Property="Background" Value="#59A862"/>
  185. <Setter Property="Foreground" Value="White"/>
  186. <Setter Property="Cursor" Value="AppStarting"/>
  187. </Trigger>
  188. <Trigger Property="IsEnabled" Value="false">
  189. <Setter Property="Background" Value="#C8E2CB"/>
  190. <Setter Property="Foreground" Value="White"/>
  191. <Setter Property="TextBlock.Foreground" Value="#498C51"/>
  192. </Trigger>
  193. </Style.Triggers>
  194. </Style>
  195. </ResourceDictionary>