ButtonStyle.xaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  3. <!--按钮通用样式(原MiddleButton)-->
  4. <LinearGradientBrush x:Key="buttonNormal" StartPoint="0.5,0" EndPoint="0.5,1">
  5. <GradientStop Color="#0086cd" Offset="0" />
  6. <GradientStop Color="#389cd0" Offset="1" />
  7. </LinearGradientBrush>
  8. <SolidColorBrush x:Key="buttonForground" Color="White"></SolidColorBrush>
  9. <SolidColorBrush x:Key="buttonBorder" Color="#62b8e5"></SolidColorBrush>
  10. <LinearGradientBrush x:Key="buttonHover" StartPoint="0.5,0" EndPoint="0.5,1">
  11. <GradientStop Color="#668fa5" Offset="0" />
  12. <GradientStop Color="#3c6982" Offset="1" />
  13. </LinearGradientBrush>
  14. <SolidColorBrush x:Key="buttonPressed" Color="#ffffff"></SolidColorBrush>
  15. <Style TargetType="Button">
  16. <Setter Property="Background" Value="{StaticResource buttonNormal}"></Setter>
  17. <Setter Property="Foreground" Value="{StaticResource buttonForground}"></Setter>
  18. <Setter Property="BorderBrush" Value="{StaticResource buttonBorder}"></Setter>
  19. <Setter Property="Cursor" Value="Hand"/>
  20. <Setter Property="Margin" Value="5"/>
  21. <Setter Property="FontFamily" Value="Arial,SimSun" />
  22. <Setter Property="FontSize" Value="17"/>
  23. <Setter Property="Height" Value="40"></Setter>
  24. <Setter Property="Width" Value="100"></Setter>
  25. <Setter Property="VerticalAlignment" Value="Top"></Setter>
  26. <Setter Property="Template">
  27. <Setter.Value>
  28. <ControlTemplate TargetType="{x:Type Button}">
  29. <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
  30. SnapsToDevicePixels="true" CornerRadius="3,3,3,3">
  31. <ContentPresenter x:Name="contentPresenter"
  32. Focusable="False"
  33. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  34. Margin="{TemplateBinding Padding}"
  35. RecognizesAccessKey="True"
  36. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  37. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  38. </Border>
  39. <ControlTemplate.Triggers>
  40. <Trigger Property="IsMouseOver" Value="true">
  41. <Setter Property="Background" TargetName="border" Value="{StaticResource buttonHover}"/>
  42. </Trigger>
  43. <Trigger Property="IsPressed" Value="true">
  44. <Setter Property="Background" TargetName="border" Value="{StaticResource buttonPressed}"/>
  45. </Trigger>
  46. <Trigger Property="IsEnabled" Value="false">
  47. <!--<Setter Property="Opacity" Value="0.5" TargetName="border"/>-->
  48. <Setter Property="Background" TargetName="border" Value="Silver" />
  49. </Trigger>
  50. </ControlTemplate.Triggers>
  51. </ControlTemplate>
  52. </Setter.Value>
  53. </Setter>
  54. </Style>
  55. <!--主窗口样式-->
  56. <!--右下角-->
  57. <!--<Style TargetType="Button" x:Key="NavUpButton">
  58. <Setter Property="Height" Value="37"></Setter>
  59. <Setter Property="Width" Value="34"></Setter>
  60. <Setter Property="Cursor" Value="Hand"></Setter>
  61. <Setter Property="HorizontalAlignment" Value="Left"></Setter>
  62. <Setter Property="VerticalAlignment" Value="Top"></Setter>
  63. <Setter Property="Template">
  64. <Setter.Value>
  65. <ControlTemplate TargetType="ButtonBase">
  66. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  67. <ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" Margin="{TemplateBinding Control.Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" />
  68. </Border>
  69. </ControlTemplate>
  70. </Setter.Value>
  71. </Setter>
  72. <Setter Property="Background" >
  73. <Setter.Value>
  74. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/上一个.png">
  75. </ImageBrush>
  76. </Setter.Value>
  77. </Setter>
  78. <Style.Triggers>
  79. <Trigger Property="IsMouseOver" Value="True">
  80. <Setter Property="Background" >
  81. <Setter.Value>
  82. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/上一个_悬停.png">
  83. </ImageBrush>
  84. </Setter.Value>
  85. </Setter>
  86. </Trigger>
  87. <Trigger Property="IsPressed" Value="True">
  88. <Setter Property="Background">
  89. <Setter.Value>
  90. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/上一个_点击.png">
  91. </ImageBrush>
  92. </Setter.Value>
  93. </Setter>
  94. </Trigger>
  95. </Style.Triggers>
  96. </Style>
  97. <Style TargetType="Button" x:Key="NavBackButton">
  98. <Setter Property="Height" Value="37"></Setter>
  99. <Setter Property="Width" Value="34"></Setter>
  100. <Setter Property="Cursor" Value="Hand"></Setter>
  101. <Setter Property="HorizontalAlignment" Value="Right"></Setter>
  102. <Setter Property="VerticalAlignment" Value="Top"></Setter>
  103. <Setter Property="Template">
  104. <Setter.Value>
  105. <ControlTemplate TargetType="ButtonBase">
  106. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  107. <ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" Margin="{TemplateBinding Control.Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" />
  108. </Border>
  109. </ControlTemplate>
  110. </Setter.Value>
  111. </Setter>
  112. <Setter Property="Background" >
  113. <Setter.Value>
  114. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/下一个.png">
  115. </ImageBrush>
  116. </Setter.Value>
  117. </Setter>
  118. <Style.Triggers>
  119. <Trigger Property="IsMouseOver" Value="True">
  120. <Setter Property="Background" >
  121. <Setter.Value>
  122. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/下一个_悬停.png">
  123. </ImageBrush>
  124. </Setter.Value>
  125. </Setter>
  126. </Trigger>
  127. <Trigger Property="IsPressed" Value="true">
  128. <Setter Property="Background" >
  129. <Setter.Value>
  130. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/下一个_点击.png">
  131. </ImageBrush>
  132. </Setter.Value>
  133. </Setter>
  134. </Trigger>
  135. </Style.Triggers>
  136. </Style>
  137. <Style TargetType="Button" x:Key="MainButton">
  138. <Setter Property="Cursor" Value="Hand"/>
  139. <Setter Property="Foreground" Value="#FF004294" />
  140. <Setter Property="BorderBrush" Value="Blue" />
  141. <Setter Property="Margin" Value="5"/>
  142. <Setter Property="FontFamily" Value="Arial,SimSun" />
  143. <Setter Property="FontSize" Value="22"/>
  144. <Setter Property="Height" Value="45"></Setter>
  145. <Setter Property="Width" Value="160"></Setter>
  146. <Setter Property="HorizontalAlignment" Value="Right"></Setter>
  147. <Setter Property="VerticalAlignment" Value="Top"></Setter>
  148. <Setter Property="Template">
  149. <Setter.Value>
  150. <ControlTemplate TargetType="ButtonBase">
  151. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  152. <ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" Margin="{TemplateBinding Control.Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" />
  153. </Border>
  154. </ControlTemplate>
  155. </Setter.Value>
  156. </Setter>
  157. <Setter Property="Background" >
  158. <Setter.Value>
  159. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/主菜单按钮.png">
  160. </ImageBrush>
  161. </Setter.Value>
  162. </Setter>
  163. <Style.Triggers>
  164. <Trigger Property="IsMouseOver" Value="True">
  165. <Setter Property="Background" >
  166. <Setter.Value>
  167. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/主菜单按钮_悬停.png">
  168. </ImageBrush>
  169. </Setter.Value>
  170. </Setter>
  171. </Trigger>
  172. <Trigger Property="IsPressed" Value="true">
  173. <Setter Property="Background" >
  174. <Setter.Value>
  175. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/主菜单按钮_点击.png">
  176. </ImageBrush>
  177. </Setter.Value>
  178. </Setter>
  179. </Trigger>
  180. </Style.Triggers>
  181. </Style>
  182. --><!--右上角--><!--
  183. <Style TargetType="Button" x:Key="MainMiddleButton">
  184. <Setter Property="FontWeight" Value="Bold"/>
  185. <Setter Property="Cursor" Value="Hand"/>
  186. <Setter Property="Foreground" Value="#FF004294" />
  187. <Setter Property="BorderBrush" Value="Blue" />
  188. <Setter Property="Margin" Value="5"/>
  189. <Setter Property="FontFamily" Value="Arial,SimSun" />
  190. <Setter Property="FontSize" Value="15"/>
  191. <Setter Property="VerticalAlignment" Value="Top" />
  192. <Setter Property="Height" Value="28"></Setter>
  193. <Setter Property="Width" Value="83"></Setter>
  194. <Setter Property="Background" >
  195. <Setter.Value>
  196. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/事件按钮.png">
  197. </ImageBrush>
  198. </Setter.Value>
  199. </Setter>
  200. <Style.Triggers>
  201. <Trigger Property="IsMouseOver" Value="True">
  202. <Setter Property="Background" >
  203. <Setter.Value>
  204. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/事件按钮_悬停.png">
  205. </ImageBrush>
  206. </Setter.Value>
  207. </Setter>
  208. </Trigger>
  209. <Trigger Property="IsPressed" Value="true">
  210. <Setter Property="Background" >
  211. <Setter.Value>
  212. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/事件按钮_点击.png">
  213. </ImageBrush>
  214. </Setter.Value>
  215. </Setter>
  216. </Trigger>
  217. </Style.Triggers>
  218. </Style>-->
  219. <!--登录窗口样式-->
  220. <Style TargetType="Button" x:Key="LoginButton">
  221. <Setter Property="Cursor" Value="Hand"/>
  222. <Setter Property="BorderBrush" Value="Blue" />
  223. <Setter Property="Margin" Value="5"/>
  224. <Setter Property="FontFamily" Value="Arial,SimSun" />
  225. <Setter Property="FontSize" Value="14"/>
  226. <Setter Property="VerticalAlignment" Value="Top" />
  227. <Setter Property="Height" Value="40"></Setter>
  228. <Setter Property="Width" Value="116"></Setter>
  229. <Setter Property="Background">
  230. <Setter.Value>
  231. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Login/按钮.png" />
  232. </Setter.Value>
  233. </Setter>
  234. <Setter Property="Template">
  235. <Setter.Value>
  236. <ControlTemplate TargetType="ButtonBase">
  237. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  238. <ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" Margin="{TemplateBinding Control.Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" />
  239. </Border>
  240. </ControlTemplate>
  241. </Setter.Value>
  242. </Setter>
  243. <Style.Triggers>
  244. <Trigger Property="IsMouseOver" Value="True">
  245. <Setter Property="Background" >
  246. <Setter.Value>
  247. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Login/按钮_悬停.png">
  248. </ImageBrush>
  249. </Setter.Value>
  250. </Setter>
  251. </Trigger>
  252. <!-- When the mouse is pressed, apply a bevel with a narrower BevelWidth to make the button appear to get pressed. -->
  253. <Trigger Property="IsFocused" Value="true">
  254. <Setter Property="Background" >
  255. <Setter.Value>
  256. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Login/按钮_点击.png">
  257. </ImageBrush>
  258. </Setter.Value>
  259. </Setter>
  260. </Trigger>
  261. </Style.Triggers>
  262. </Style>
  263. <!--按钮缩放,多用于PM气流图等界面-->
  264. <!--<Style TargetType="Button" x:Key="SmallButton">
  265. <Setter Property="FontWeight" Value="Bold"/>
  266. <Setter Property="Cursor" Value="Hand"/>
  267. <Setter Property="Foreground" Value="#FF181C1F" />
  268. <Setter Property="Background" Value="CadetBlue" />
  269. <Setter Property="BorderBrush" Value="Blue" />
  270. <Setter Property="Margin" Value="5"/>
  271. <Setter Property="FontFamily" Value="Arial,SimSun" />
  272. <Setter Property="FontSize" Value="14"/>
  273. <Setter Property="VerticalAlignment" Value="Top" />
  274. <Setter Property="Height" Value="23"></Setter>
  275. <Setter Property="Width" Value="65"></Setter>
  276. <Setter Property="BitmapEffect" >
  277. <Setter.Value>
  278. <BevelBitmapEffect BevelWidth="2" />
  279. </Setter.Value>
  280. </Setter>
  281. <Style.Triggers>
  282. <Trigger Property="IsMouseOver" Value="True">
  283. <Setter Property="Foreground" Value="Green" />
  284. </Trigger>
  285. <Trigger Property="IsPressed" Value="true">
  286. <Setter Property="BitmapEffect" >
  287. <Setter.Value>
  288. <BevelBitmapEffect BevelWidth="3" />
  289. </Setter.Value>
  290. </Setter>
  291. </Trigger>
  292. </Style.Triggers>
  293. </Style>-->
  294. <!--反应腔盖-->
  295. <!--<Style TargetType="Button" x:Key="ReactorMiniButtonStyle">
  296. <Setter Property="FontSize" Value="15" />
  297. <Setter Property="Focusable" Value="False" />
  298. <Setter Property="Cursor" Value="Hand" />
  299. </Style>-->
  300. </ResourceDictionary>