RadioButton.xaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. <!-- Normal Button style -->
  28. <Style TargetType="{x:Type RadioButton}" x:Key="NormalRadioButtonStyle">
  29. <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
  30. <Setter Property="Background" Value="{StaticResource RadioButton_BG}"/>
  31. <Setter Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  32. <Setter Property="BorderThickness" Value="1,1,0,0"/>
  33. <Setter Property="Foreground" Value="{DynamicResource FG_White}"/>
  34. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  35. <Setter Property="VerticalContentAlignment" Value="Center"/>
  36. <Setter Property="Padding" Value="6,3"/>
  37. <Setter Property="MinWidth" Value="40"/>
  38. <Setter Property="MinHeight" Value="20"/>
  39. <Setter Property="SnapsToDevicePixels" Value="True"/>
  40. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
  41. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  42. <Setter Property="Stylus.IsTouchFeedbackEnabled" Value="False"/>
  43. <Setter Property="Border.CornerRadius" Value="4"/>
  44. <Setter Property="Template">
  45. <Setter.Value>
  46. <ControlTemplate TargetType="{x:Type RadioButton}">
  47. <Border x:Name="BG" BorderThickness="{TemplateBinding BorderThickness}"
  48. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  49. CornerRadius="{TemplateBinding Border.CornerRadius}"
  50. BorderBrush="{TemplateBinding BorderBrush}"
  51. Background="{TemplateBinding Background}" Cursor="Hand">
  52. <Border x:Name="Inner_BD"
  53. BorderBrush="WhiteSmoke"
  54. BorderThickness="0,0,2,2" Margin="0,0,-2,-2" CornerRadius="3" Padding="5,1">
  55. <ContentPresenter x:Name="contentpresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  56. Margin="{TemplateBinding Padding}" RecognizesAccessKey="True"
  57. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  58. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Cursor="Hand">
  59. </ContentPresenter>
  60. </Border>
  61. </Border>
  62. <ControlTemplate.Triggers>
  63. <!--<Trigger Property="IsMouseOver" Value="True">
  64. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_MouseOver}"/>
  65. </Trigger>-->
  66. <Trigger Property="IsPressed" Value="True">
  67. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Press}"/>
  68. <Setter TargetName="BG" Property="Margin" Value="1"/>
  69. <Setter Property="FontSize" Value="13"/>
  70. </Trigger>
  71. <Trigger Property="IsEnabled" Value="False">
  72. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Unable}"/>
  73. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>
  74. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Unable}"/>
  75. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  76. </Trigger>
  77. <Trigger Property="IsChecked" Value="True">
  78. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Unable}"/>
  79. <Setter Property="FontSize" Value="13"/>
  80. <Setter Property="FontWeight" Value="Bold"/>
  81. <!--<Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>-->
  82. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Unable}"/>
  83. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  84. </Trigger>
  85. <Trigger Property="IsChecked" Value="False">
  86. <Setter TargetName="BG" Property="BorderBrush" Value="White"/>
  87. <Setter Property="FontSize" Value="13"/>
  88. <Setter Property="FontWeight" Value="Normal"/>
  89. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  90. <Setter Property="TextBlock.Foreground" TargetName="contentpresenter" Value="{DynamicResource FG_Black}"/>
  91. </Trigger>
  92. </ControlTemplate.Triggers>
  93. </ControlTemplate>
  94. </Setter.Value>
  95. </Setter>
  96. </Style>
  97. <Style TargetType="RadioButton" BasedOn="{StaticResource NormalRadioButtonStyle}"/>
  98. <Style TargetType="RadioButton" x:Key="NormalRadioButton"/>
  99. <Style x:Key="DemoStyle" TargetType="{x:Type RadioButton}">
  100. <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
  101. <Setter Property="Background" Value="{StaticResource RadioButton_BG_Color}"/>
  102. <Setter Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  103. <Setter Property="BorderThickness" Value="1,1,0,0"/>
  104. <Setter Property="FontFamily" Value="Arial"/>
  105. <Setter Property="FontSize" Value="14"/>
  106. <Setter Property="Foreground" Value="{DynamicResource FG_Black}"/>
  107. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  108. <Setter Property="VerticalContentAlignment" Value="Center"/>
  109. <Setter Property="Padding" Value="6,3"/>
  110. <Setter Property="MinWidth" Value="40"/>
  111. <Setter Property="MinHeight" Value="20"/>
  112. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
  113. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  114. <Setter Property="Stylus.IsTouchFeedbackEnabled" Value="False"/>
  115. <Setter Property="SnapsToDevicePixels" Value="True"/>
  116. <Setter Property="Border.CornerRadius" Value="4"/>
  117. <Setter Property="Template">
  118. <Setter.Value>
  119. <ControlTemplate TargetType="{x:Type RadioButton}">
  120. <Border x:Name="BG" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" CornerRadius="{TemplateBinding Border.CornerRadius}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Cursor="Hand">
  121. <Border x:Name="Inner_BD" BorderBrush="{StaticResource RadioButton_BD_Shadow}" BorderThickness="0,0,1,1" CornerRadius="3" Padding="5,1">
  122. <ContentPresenter x:Name="contentpresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Cursor="Hand">
  123. </ContentPresenter>
  124. </Border>
  125. </Border>
  126. <ControlTemplate.Triggers>
  127. <Trigger Property="IsMouseOver" Value="True">
  128. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_MouseOver}"/>
  129. </Trigger>
  130. <Trigger Property="IsPressed" Value="True">
  131. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Press}"/>
  132. <Setter TargetName="BG" Property="Margin" Value="1"/>
  133. <Setter Property="FontSize" Value="13"/>
  134. </Trigger>
  135. <Trigger Property="IsEnabled" Value="False">
  136. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Unable}"/>
  137. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Unable}"/>
  138. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Unable}"/>
  139. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  140. </Trigger>
  141. <Trigger Property="IsChecked" Value="True">
  142. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Checked}"/>
  143. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Checked}"/>
  144. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Checked}"/>
  145. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  146. </Trigger>
  147. <Trigger Property="IsChecked" Value="False">
  148. <Setter TargetName="BG" Property="Background" Value="{StaticResource RadioButton_BG_Color}"/>
  149. <Setter TargetName="BG" Property="BorderBrush" Value="{StaticResource RadioButton_BD}"/>
  150. <Setter TargetName="Inner_BD" Property="BorderBrush" Value="{StaticResource RadioButton_BD_Shadow_Checked}"/>
  151. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  152. </Trigger>
  153. </ControlTemplate.Triggers>
  154. </ControlTemplate>
  155. </Setter.Value>
  156. </Setter>
  157. </Style>
  158. </ResourceDictionary>