RadioButton.xaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
  5. xmlns:ctrl="http://OpenSEMI.Ctrlib.com/presentation"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. mc:Ignorable="d">
  9. <SolidColorBrush x:Key="RadioButton_BG" Color="#FF6398CC"/>
  10. <LinearGradientBrush x:Key="RadioButton_BG_Color" StartPoint="0,1" EndPoint="0,0">
  11. <GradientStop Offset="0" Color="White"/>
  12. <GradientStop Offset="0.9" Color="White"/>
  13. <GradientStop Offset="1" Color="#FFD0D0D0"/>
  14. </LinearGradientBrush>
  15. <SolidColorBrush x:Key="RadioButton_BD" Color="#FFC6D8EC"/>
  16. <SolidColorBrush x:Key="RadioButton_BD_Shadow" Color="#FF284775"/>
  17. <SolidColorBrush x:Key="RadioButton_BG_MouseOver" Color="#FF4FCBFF"/>
  18. <SolidColorBrush x:Key="RadioButton_BG_Press" Color="#FF5A89D4"/>
  19. <SolidColorBrush x:Key="RadioButton_BG_Unable" Color="#FFD2D2D2"/>
  20. <SolidColorBrush x:Key="RadioButton_BD_Unable" Color="#FFF3F3F3"/>
  21. <SolidColorBrush x:Key="RadioButton_BD_Shadow_Unable" Color="Blue"/>
  22. <!-- //#FF9D9D9D -->
  23. <SolidColorBrush x:Key="RadioButton_BG_Checked" Color="#FF376091"/>
  24. <SolidColorBrush x:Key="RadioButton_BD_Checked" Color="#FFF3F3F3"/>
  25. <SolidColorBrush x:Key="RadioButton_BD_Shadow_Checked" Color="#FF9D9D9D"/>
  26. <SolidColorBrush x:Key="TopFrame_BG" Color="#FFD1E3CF"/>
  27. <Style x:Key="RadioButtonHightStyle" TargetType="{x:Type RadioButton}">
  28. <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
  29. <Setter Property="Background" Value="{StaticResource RadioButton_BG}"/>
  30. <Setter Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  31. <Setter Property="BorderThickness" Value="1,1,0,0"/>
  32. <Setter Property="Foreground" Value="{DynamicResource FG_White}"/>
  33. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  34. <Setter Property="VerticalContentAlignment" Value="Center"/>
  35. <Setter Property="Padding" Value="6,3"/>
  36. <Setter Property="MinWidth" Value="40"/>
  37. <Setter Property="MinHeight" Value="20"/>
  38. <Setter Property="SnapsToDevicePixels" Value="True"/>
  39. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
  40. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  41. <Setter Property="Stylus.IsTouchFeedbackEnabled" Value="False"/>
  42. <Setter Property="Border.CornerRadius" Value="4"/>
  43. <Setter Property="Template">
  44. <Setter.Value>
  45. <ControlTemplate TargetType="{x:Type RadioButton}">
  46. <Border
  47. x:Name="BG"
  48. Background="{TemplateBinding Background}"
  49. BorderBrush="{TemplateBinding BorderBrush}"
  50. BorderThickness="{TemplateBinding BorderThickness}"
  51. CornerRadius="{TemplateBinding Border.CornerRadius}"
  52. Cursor="Hand"
  53. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  54. <Border
  55. x:Name="Inner_BD"
  56. Margin="0,0,-2,-2"
  57. Padding="5,1"
  58. BorderBrush="WhiteSmoke"
  59. BorderThickness="0,0,2,2"
  60. CornerRadius="3">
  61. <ContentPresenter
  62. x:Name="contentpresenter"
  63. Margin="{TemplateBinding Padding}"
  64. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  65. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  66. Cursor="Hand"
  67. RecognizesAccessKey="True"
  68. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  69. </Border>
  70. </Border>
  71. <ControlTemplate.Triggers>
  72. <!--<Trigger Property="IsMouseOver" Value="True">
  73. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_MouseOver}"/>
  74. </Trigger>-->
  75. <Trigger Property="IsPressed" Value="True">
  76. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Press}"/>
  77. <Setter TargetName="BG" Property="Margin" Value="1"/>
  78. <Setter Property="FontSize" Value="13"/>
  79. </Trigger>
  80. <Trigger Property="IsEnabled" Value="False">
  81. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Unable}"/>
  82. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>
  83. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Unable}"/>
  84. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  85. </Trigger>
  86. <Trigger Property="IsChecked" Value="True">
  87. <Setter TargetName="BG" Property="Background" Value="#FF49BD9A"/>
  88. <Setter Property="FontSize" Value="13"/>
  89. <Setter Property="FontWeight" Value="Bold"/>
  90. <!--<Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>-->
  91. <Setter Property="Foreground" Value="White"/>
  92. </Trigger>
  93. <Trigger Property="IsChecked" Value="False">
  94. <Setter TargetName="BG" Property="BorderBrush" Value="White"/>
  95. <Setter Property="FontSize" Value="13"/>
  96. <Setter Property="FontWeight" Value="Normal"/>
  97. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  98. <Setter TargetName="contentpresenter" Property="TextBlock.Foreground" Value="{DynamicResource FG_Black}"/>
  99. </Trigger>
  100. </ControlTemplate.Triggers>
  101. </ControlTemplate>
  102. </Setter.Value>
  103. </Setter>
  104. </Style>
  105. <!-- Normal Button style -->
  106. <Style x:Key="NormalRadioButtonStyle" TargetType="{x:Type RadioButton}">
  107. <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
  108. <Setter Property="Background" Value="{StaticResource RadioButton_BG}"/>
  109. <Setter Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  110. <Setter Property="BorderThickness" Value="1,1,0,0"/>
  111. <Setter Property="Foreground" Value="{DynamicResource FG_White}"/>
  112. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  113. <Setter Property="VerticalContentAlignment" Value="Center"/>
  114. <Setter Property="Padding" Value="6,3"/>
  115. <Setter Property="MinWidth" Value="40"/>
  116. <Setter Property="MinHeight" Value="20"/>
  117. <Setter Property="SnapsToDevicePixels" Value="True"/>
  118. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
  119. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  120. <Setter Property="Stylus.IsTouchFeedbackEnabled" Value="False"/>
  121. <Setter Property="Border.CornerRadius" Value="4"/>
  122. <Setter Property="Template">
  123. <Setter.Value>
  124. <ControlTemplate TargetType="{x:Type RadioButton}">
  125. <Border
  126. x:Name="BG"
  127. Background="{TemplateBinding Background}"
  128. BorderBrush="{TemplateBinding BorderBrush}"
  129. BorderThickness="{TemplateBinding BorderThickness}"
  130. CornerRadius="{TemplateBinding Border.CornerRadius}"
  131. Cursor="Hand"
  132. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  133. <Border
  134. x:Name="Inner_BD"
  135. Margin="0,0,-2,-2"
  136. Padding="5,1"
  137. BorderBrush="WhiteSmoke"
  138. BorderThickness="0,0,2,2"
  139. CornerRadius="3">
  140. <ContentPresenter
  141. x:Name="contentpresenter"
  142. Margin="{TemplateBinding Padding}"
  143. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  144. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  145. Cursor="Hand"
  146. RecognizesAccessKey="True"
  147. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  148. </Border>
  149. </Border>
  150. <ControlTemplate.Triggers>
  151. <!--<Trigger Property="IsMouseOver" Value="True">
  152. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_MouseOver}"/>
  153. </Trigger>-->
  154. <Trigger Property="IsPressed" Value="True">
  155. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Press}"/>
  156. <Setter TargetName="BG" Property="Margin" Value="1"/>
  157. <Setter Property="FontSize" Value="13"/>
  158. </Trigger>
  159. <Trigger Property="IsEnabled" Value="False">
  160. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Unable}"/>
  161. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>
  162. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Unable}"/>
  163. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  164. </Trigger>
  165. <Trigger Property="IsChecked" Value="True">
  166. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Unable}"/>
  167. <Setter Property="FontSize" Value="13"/>
  168. <Setter Property="FontWeight" Value="Bold"/>
  169. <!--<Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>-->
  170. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Unable}"/>
  171. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  172. </Trigger>
  173. <Trigger Property="IsChecked" Value="False">
  174. <Setter TargetName="BG" Property="BorderBrush" Value="White"/>
  175. <Setter Property="FontSize" Value="13"/>
  176. <Setter Property="FontWeight" Value="Normal"/>
  177. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  178. <Setter TargetName="contentpresenter" Property="TextBlock.Foreground" Value="{DynamicResource FG_Black}"/>
  179. </Trigger>
  180. </ControlTemplate.Triggers>
  181. </ControlTemplate>
  182. </Setter.Value>
  183. </Setter>
  184. </Style>
  185. <Style BasedOn="{StaticResource NormalRadioButtonStyle}" TargetType="RadioButton"/>
  186. <Style x:Key="NormalRadioButton" TargetType="RadioButton"/>
  187. <Style x:Key="DemoStyle" TargetType="{x:Type RadioButton}">
  188. <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
  189. <Setter Property="Background" Value="{StaticResource RadioButton_BG_Color}"/>
  190. <Setter Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  191. <Setter Property="BorderThickness" Value="1,1,0,0"/>
  192. <Setter Property="FontFamily" Value="Arial"/>
  193. <Setter Property="FontSize" Value="14"/>
  194. <Setter Property="Foreground" Value="{DynamicResource FG_Black}"/>
  195. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  196. <Setter Property="VerticalContentAlignment" Value="Center"/>
  197. <Setter Property="Padding" Value="6,3"/>
  198. <Setter Property="MinWidth" Value="40"/>
  199. <Setter Property="MinHeight" Value="20"/>
  200. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
  201. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  202. <Setter Property="Stylus.IsTouchFeedbackEnabled" Value="False"/>
  203. <Setter Property="SnapsToDevicePixels" Value="True"/>
  204. <Setter Property="Border.CornerRadius" Value="4"/>
  205. <Setter Property="Template">
  206. <Setter.Value>
  207. <ControlTemplate TargetType="{x:Type RadioButton}">
  208. <Border
  209. x:Name="BG"
  210. Background="{TemplateBinding Background}"
  211. BorderBrush="{TemplateBinding BorderBrush}"
  212. BorderThickness="{TemplateBinding BorderThickness}"
  213. CornerRadius="{TemplateBinding Border.CornerRadius}"
  214. Cursor="Hand"
  215. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  216. <Border
  217. x:Name="Inner_BD"
  218. Padding="5,1"
  219. BorderBrush="{StaticResource RadioButton_BD_Shadow}"
  220. BorderThickness="0,0,1,1"
  221. CornerRadius="3">
  222. <ContentPresenter
  223. x:Name="contentpresenter"
  224. Margin="{TemplateBinding Padding}"
  225. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  226. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  227. Cursor="Hand"
  228. RecognizesAccessKey="True"
  229. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  230. </Border>
  231. </Border>
  232. <ControlTemplate.Triggers>
  233. <Trigger Property="IsMouseOver" Value="True">
  234. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_MouseOver}"/>
  235. </Trigger>
  236. <Trigger Property="IsPressed" Value="True">
  237. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Press}"/>
  238. <Setter TargetName="BG" Property="Margin" Value="1"/>
  239. <Setter Property="FontSize" Value="13"/>
  240. </Trigger>
  241. <Trigger Property="IsEnabled" Value="False">
  242. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Unable}"/>
  243. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>
  244. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Unable}"/>
  245. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  246. </Trigger>
  247. <Trigger Property="IsChecked" Value="True">
  248. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Checked}"/>
  249. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Checked}"/>
  250. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Checked}"/>
  251. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  252. </Trigger>
  253. <Trigger Property="IsChecked" Value="False">
  254. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Color}"/>
  255. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  256. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Checked}"/>
  257. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  258. </Trigger>
  259. </ControlTemplate.Triggers>
  260. </ControlTemplate>
  261. </Setter.Value>
  262. </Setter>
  263. </Style>
  264. </ResourceDictionary>