RadioButton.xaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:ctrl="http://OpenSEMI.Ctrlib.com/presentation"
  7. xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
  8. mc:Ignorable="d">
  9. <SolidColorBrush x:Key="RadioButton_BG" Color="#FF6398CC"/>
  10. <LinearGradientBrush x:Key="RadioButton_BG_Color" EndPoint="0,0" StartPoint="0,1">
  11. <GradientStop Color="White" Offset="0"/>
  12. <GradientStop Color="White" Offset="0.9"/>
  13. <GradientStop Color="#FFD0D0D0" Offset="1"/>
  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 TargetType="{x:Type RadioButton}" x:Key="RadioButtonHightStyle">
  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 x:Name="BG" BorderThickness="{TemplateBinding BorderThickness}"
  47. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  48. CornerRadius="{TemplateBinding Border.CornerRadius}"
  49. BorderBrush="{TemplateBinding BorderBrush}"
  50. Background="{TemplateBinding Background}" Cursor="Hand">
  51. <Border x:Name="Inner_BD"
  52. BorderBrush="WhiteSmoke"
  53. BorderThickness="0,0,2,2" Margin="0,0,-2,-2" CornerRadius="3" Padding="5,1">
  54. <ContentPresenter x:Name="contentpresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  55. Margin="{TemplateBinding Padding}" RecognizesAccessKey="True"
  56. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  57. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Cursor="Hand"></ContentPresenter>
  58. </Border>
  59. </Border>
  60. <ControlTemplate.Triggers>
  61. <!--<Trigger Property="IsMouseOver" Value="True">
  62. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_MouseOver}"/>
  63. </Trigger>-->
  64. <Trigger Property="IsPressed" Value="True">
  65. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Press}"/>
  66. <Setter TargetName="BG" Property="Margin" Value="1"/>
  67. <Setter Property="FontSize" Value="13"/>
  68. </Trigger>
  69. <Trigger Property="IsEnabled" Value="False">
  70. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Unable}"/>
  71. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>
  72. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Unable}"/>
  73. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  74. </Trigger>
  75. <Trigger Property="IsChecked" Value="True">
  76. <Setter TargetName="BG" Property="Background" Value="#FF49BD9A"/>
  77. <Setter Property="FontSize" Value="13"/>
  78. <Setter Property="FontWeight" Value="Bold"/>
  79. <!--<Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>-->
  80. <Setter Property="Foreground" Value="White"/>
  81. </Trigger>
  82. <Trigger Property="IsChecked" Value="False">
  83. <Setter TargetName="BG" Property="BorderBrush" Value="White"/>
  84. <Setter Property="FontSize" Value="13"/>
  85. <Setter Property="FontWeight" Value="Normal"/>
  86. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  87. <Setter Property="TextBlock.Foreground" TargetName="contentpresenter" Value="{DynamicResource FG_Black}"/>
  88. </Trigger>
  89. </ControlTemplate.Triggers>
  90. </ControlTemplate>
  91. </Setter.Value>
  92. </Setter>
  93. </Style>
  94. <!-- Normal Button style -->
  95. <Style TargetType="{x:Type RadioButton}" x:Key="NormalRadioButtonStyle">
  96. <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
  97. <Setter Property="Background" Value="{StaticResource RadioButton_BG}"/>
  98. <Setter Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  99. <Setter Property="BorderThickness" Value="1,1,0,0"/>
  100. <Setter Property="Foreground" Value="{DynamicResource FG_White}"/>
  101. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  102. <Setter Property="VerticalContentAlignment" Value="Center"/>
  103. <Setter Property="Padding" Value="6,3"/>
  104. <Setter Property="MinWidth" Value="40"/>
  105. <Setter Property="MinHeight" Value="20"/>
  106. <Setter Property="SnapsToDevicePixels" Value="True"/>
  107. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
  108. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  109. <Setter Property="Stylus.IsTouchFeedbackEnabled" Value="False"/>
  110. <Setter Property="Border.CornerRadius" Value="4"/>
  111. <Setter Property="Template">
  112. <Setter.Value>
  113. <ControlTemplate TargetType="{x:Type RadioButton}">
  114. <Border x:Name="BG" BorderThickness="{TemplateBinding BorderThickness}"
  115. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  116. CornerRadius="{TemplateBinding Border.CornerRadius}"
  117. BorderBrush="{TemplateBinding BorderBrush}"
  118. Background="{TemplateBinding Background}" Cursor="Hand">
  119. <Border x:Name="Inner_BD"
  120. BorderBrush="WhiteSmoke"
  121. BorderThickness="0,0,2,2" Margin="0,0,-2,-2" CornerRadius="3" Padding="5,1">
  122. <ContentPresenter x:Name="contentpresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  123. Margin="{TemplateBinding Padding}" RecognizesAccessKey="True"
  124. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  125. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Cursor="Hand"></ContentPresenter>
  126. </Border>
  127. </Border>
  128. <ControlTemplate.Triggers>
  129. <!--<Trigger Property="IsMouseOver" Value="True">
  130. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_MouseOver}"/>
  131. </Trigger>-->
  132. <Trigger Property="IsPressed" Value="True">
  133. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Press}"/>
  134. <Setter TargetName="BG" Property="Margin" Value="1"/>
  135. <Setter Property="FontSize" Value="13"/>
  136. </Trigger>
  137. <Trigger Property="IsEnabled" Value="False">
  138. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Unable}"/>
  139. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>
  140. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Unable}"/>
  141. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  142. </Trigger>
  143. <Trigger Property="IsChecked" Value="True">
  144. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Unable}"/>
  145. <Setter Property="FontSize" Value="13"/>
  146. <Setter Property="FontWeight" Value="Bold"/>
  147. <!--<Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>-->
  148. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Unable}"/>
  149. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  150. </Trigger>
  151. <Trigger Property="IsChecked" Value="False">
  152. <Setter TargetName="BG" Property="BorderBrush" Value="White"/>
  153. <Setter Property="FontSize" Value="13"/>
  154. <Setter Property="FontWeight" Value="Normal"/>
  155. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  156. <Setter Property="TextBlock.Foreground" TargetName="contentpresenter" Value="{DynamicResource FG_Black}"/>
  157. </Trigger>
  158. </ControlTemplate.Triggers>
  159. </ControlTemplate>
  160. </Setter.Value>
  161. </Setter>
  162. </Style>
  163. <Style TargetType="RadioButton" BasedOn="{StaticResource NormalRadioButtonStyle}"/>
  164. <Style TargetType="RadioButton" x:Key="NormalRadioButton"/>
  165. <Style x:Key="DemoStyle" TargetType="{x:Type RadioButton}">
  166. <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
  167. <Setter Property="Background" Value="{StaticResource RadioButton_BG_Color}"/>
  168. <Setter Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  169. <Setter Property="BorderThickness" Value="1,1,0,0"/>
  170. <Setter Property="FontFamily" Value="Arial"/>
  171. <Setter Property="FontSize" Value="14"/>
  172. <Setter Property="Foreground" Value="{DynamicResource FG_Black}"/>
  173. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  174. <Setter Property="VerticalContentAlignment" Value="Center"/>
  175. <Setter Property="Padding" Value="6,3"/>
  176. <Setter Property="MinWidth" Value="40"/>
  177. <Setter Property="MinHeight" Value="20"/>
  178. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
  179. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  180. <Setter Property="Stylus.IsTouchFeedbackEnabled" Value="False"/>
  181. <Setter Property="SnapsToDevicePixels" Value="True"/>
  182. <Setter Property="Border.CornerRadius" Value="4"/>
  183. <Setter Property="Template">
  184. <Setter.Value>
  185. <ControlTemplate TargetType="{x:Type RadioButton}">
  186. <Border x:Name="BG" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" CornerRadius="{TemplateBinding Border.CornerRadius}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Cursor="Hand">
  187. <Border x:Name="Inner_BD" BorderBrush="{StaticResource RadioButton_BD_Shadow}" BorderThickness="0,0,1,1" CornerRadius="3" Padding="5,1">
  188. <ContentPresenter x:Name="contentpresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Cursor="Hand"></ContentPresenter>
  189. </Border>
  190. </Border>
  191. <ControlTemplate.Triggers>
  192. <Trigger Property="IsMouseOver" Value="True">
  193. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_MouseOver}"/>
  194. </Trigger>
  195. <Trigger Property="IsPressed" Value="True">
  196. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Press}"/>
  197. <Setter TargetName="BG" Property="Margin" Value="1"/>
  198. <Setter Property="FontSize" Value="13"/>
  199. </Trigger>
  200. <Trigger Property="IsEnabled" Value="False">
  201. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Unable}"/>
  202. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>
  203. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Unable}"/>
  204. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  205. </Trigger>
  206. <Trigger Property="IsChecked" Value="True">
  207. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Checked}"/>
  208. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Checked}"/>
  209. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Checked}"/>
  210. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  211. </Trigger>
  212. <Trigger Property="IsChecked" Value="False">
  213. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Color}"/>
  214. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  215. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Checked}"/>
  216. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  217. </Trigger>
  218. </ControlTemplate.Triggers>
  219. </ControlTemplate>
  220. </Setter.Value>
  221. </Setter>
  222. </Style>
  223. </ResourceDictionary>