CheckedBoxStyle.xaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <Style x:Key="CheckRadioFocusVisual">
  3. <Setter Property="Control.Template">
  4. <Setter.Value>
  5. <ControlTemplate>
  6. <Rectangle Margin="14,0,0,0"
  7. SnapsToDevicePixels="true"
  8. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  9. StrokeDashArray="1 2"
  10. StrokeThickness="1" />
  11. </ControlTemplate>
  12. </Setter.Value>
  13. </Setter>
  14. </Style>
  15. <Style x:Key="EmptyCheckBoxFocusVisual">
  16. <Setter Property="Control.Template">
  17. <Setter.Value>
  18. <ControlTemplate>
  19. <Rectangle Margin="1"
  20. SnapsToDevicePixels="true"
  21. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  22. StrokeDashArray="1 2"
  23. StrokeThickness="1" />
  24. </ControlTemplate>
  25. </Setter.Value>
  26. </Setter>
  27. </Style>
  28. <Style x:Key="mtpCheckBoxStyle" TargetType="{x:Type CheckBox}">
  29. <Setter Property="VerticalContentAlignment" Value="Center" />
  30. <Setter Property="Foreground" Value="{DynamicResource MainForegroundBrush}" />
  31. <Setter Property="BorderBrush" Value="{DynamicResource CommonBorderBrush}" />
  32. <Setter Property="BorderThickness" Value="2" />
  33. <Setter Property="Padding" Value="2,0,0,0" />
  34. <Setter Property="FocusVisualStyle" Value="{StaticResource EmptyCheckBoxFocusVisual}" />
  35. <Setter Property="Template">
  36. <Setter.Value>
  37. <ControlTemplate TargetType="{x:Type CheckBox}">
  38. <Grid>
  39. <Rectangle Name="OutSideBorder"
  40. HorizontalAlignment="Stretch"
  41. VerticalAlignment="Stretch"
  42. SnapsToDevicePixels="true"
  43. Stroke="{DynamicResource FocusVisualBrush}"
  44. StrokeDashArray="1,2"
  45. StrokeThickness="1"
  46. Visibility="Collapsed" />
  47. <Grid Margin="1">
  48. <Grid.ColumnDefinitions>
  49. <ColumnDefinition Width="Auto" />
  50. <ColumnDefinition />
  51. </Grid.ColumnDefinitions>
  52. <Rectangle x:Name="CheckMark"
  53. Width="15"
  54. Height="15"
  55. Fill="White"
  56. Stroke="{TemplateBinding BorderBrush}"
  57. StrokeThickness="1" />
  58. <Path x:Name="CheckMarkPath"
  59. Margin="1,1,1,1"
  60. Data="F1M1,12C1,12 4,8 4,8 4,8 8,14 8,14 8,14 15,1 15,1 15,1 18,4 18,4 18,4 8,18 8,18 8,18 1,12 1,12z"
  61. Fill="{DynamicResource CheckedBrush}"
  62. FlowDirection="LeftToRight" />
  63. <ContentPresenter Grid.Column="1"
  64. Margin="{TemplateBinding Padding}"
  65. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  66. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  67. RecognizesAccessKey="True"
  68. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  69. </Grid>
  70. </Grid>
  71. <ControlTemplate.Triggers>
  72. <Trigger Property="IsChecked" Value="false">
  73. <Setter TargetName="CheckMarkPath" Property="Visibility" Value="Collapsed" />
  74. </Trigger>
  75. <Trigger Property="IsChecked" Value="{x:Null}">
  76. <Setter TargetName="CheckMark" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" />
  77. <Setter TargetName="CheckMarkPath" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
  78. </Trigger>
  79. <Trigger Property="IsPressed" Value="true">
  80. <Setter TargetName="CheckMark" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
  81. </Trigger>
  82. <Trigger Property="IsEnabled" Value="false">
  83. <Setter TargetName="CheckMark" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
  84. <Setter TargetName="CheckMarkPath" Property="Fill" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  85. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  86. </Trigger>
  87. <Trigger Property="IsFocused" Value="True">
  88. <Setter TargetName="OutSideBorder" Property="Visibility" Value="Visible" />
  89. </Trigger>
  90. </ControlTemplate.Triggers>
  91. </ControlTemplate>
  92. </Setter.Value>
  93. </Setter>
  94. </Style>
  95. <Style x:Key="OrderCheckBoxStyle" TargetType="{x:Type CheckBox}">
  96. <Setter Property="VerticalContentAlignment" Value="Center" />
  97. <Setter Property="Foreground" Value="{DynamicResource MainForegroundBrush}" />
  98. <Setter Property="BorderBrush" Value="{DynamicResource CommonBorderBrush}" />
  99. <Setter Property="BorderThickness" Value="2" />
  100. <Setter Property="Padding" Value="2,0,0,0" />
  101. <Setter Property="FocusVisualStyle" Value="{StaticResource EmptyCheckBoxFocusVisual}" />
  102. <Setter Property="Template">
  103. <Setter.Value>
  104. <ControlTemplate TargetType="{x:Type CheckBox}">
  105. <Grid>
  106. <Rectangle Name="OutSideBorder"
  107. HorizontalAlignment="Stretch"
  108. VerticalAlignment="Stretch"
  109. SnapsToDevicePixels="true"
  110. Stroke="{DynamicResource FocusVisualBrush}"
  111. StrokeDashArray="1,2"
  112. StrokeThickness="1"
  113. Visibility="Collapsed" />
  114. <Grid>
  115. <Grid.ColumnDefinitions>
  116. <ColumnDefinition />
  117. <ColumnDefinition Width="Auto" />
  118. </Grid.ColumnDefinitions>
  119. <ContentPresenter Grid.Column="0"
  120. Margin="{TemplateBinding Padding}"
  121. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  122. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  123. RecognizesAccessKey="True"
  124. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  125. <Path x:Name="checkPath"
  126. Grid.Column="1"
  127. Margin="5,0"
  128. VerticalAlignment="Center"
  129. Data="M1,4.5L4.5,1 8,4.5"
  130. Stroke="{TemplateBinding Foreground}"
  131. Visibility="Collapsed" />
  132. <Path x:Name="unCheckPath"
  133. Grid.Column="1"
  134. Margin="5,0"
  135. VerticalAlignment="Center"
  136. Data="M1,1.5L4.5,5 8,1.5"
  137. Stroke="{TemplateBinding Foreground}" />
  138. </Grid>
  139. </Grid>
  140. <ControlTemplate.Triggers>
  141. <Trigger Property="IsChecked" Value="false">
  142. <Setter TargetName="checkPath" Property="Visibility" Value="Collapsed" />
  143. <Setter TargetName="unCheckPath" Property="Visibility" Value="Visible" />
  144. </Trigger>
  145. <Trigger Property="IsChecked" Value="True">
  146. <Setter TargetName="checkPath" Property="Visibility" Value="Visible" />
  147. <Setter TargetName="unCheckPath" Property="Visibility" Value="Collapsed" />
  148. </Trigger>
  149. <Trigger Property="IsChecked" Value="{x:Null}">
  150. <Setter TargetName="checkPath" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" />
  151. <Setter TargetName="unCheckPath" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
  152. </Trigger>
  153. <Trigger Property="IsFocused" Value="True">
  154. <Setter TargetName="OutSideBorder" Property="Visibility" Value="Visible" />
  155. </Trigger>
  156. <!--
  157. <Trigger Property="IsPressed" Value="true">
  158. <Setter TargetName="CheckMark" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
  159. </Trigger>
  160. <Trigger Property="IsEnabled" Value="false">
  161. <Setter TargetName="CheckMark" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
  162. <Setter TargetName="CheckMarkPath" Property="Fill" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  163. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  164. </Trigger>
  165. -->
  166. </ControlTemplate.Triggers>
  167. </ControlTemplate>
  168. </Setter.Value>
  169. </Setter>
  170. </Style>
  171. <Style x:Key="AccountInfoCheckBoxStyle" TargetType="{x:Type CheckBox}">
  172. <Setter Property="VerticalContentAlignment" Value="Center" />
  173. <Setter Property="Foreground" Value="{DynamicResource MainForegroundBrush}" />
  174. <Setter Property="BorderBrush" Value="{DynamicResource CommonBorderBrush}" />
  175. <Setter Property="BorderThickness" Value="2" />
  176. <Setter Property="Padding" Value="2" />
  177. <Setter Property="FocusVisualStyle" Value="{StaticResource EmptyCheckBoxFocusVisual}" />
  178. <Setter Property="Template">
  179. <Setter.Value>
  180. <ControlTemplate TargetType="{x:Type CheckBox}">
  181. <Grid>
  182. <Rectangle Name="OutSideBorder"
  183. HorizontalAlignment="Stretch"
  184. VerticalAlignment="Stretch"
  185. SnapsToDevicePixels="true"
  186. Stroke="{DynamicResource FocusVisualBrush}"
  187. StrokeDashArray="1,2"
  188. StrokeThickness="1"
  189. Visibility="Collapsed" />
  190. <Border Name="BackgroudGrid"
  191. Margin="{Binding Padding}"
  192. CornerRadius="4">
  193. <Grid>
  194. <Grid.ColumnDefinitions>
  195. <ColumnDefinition />
  196. <ColumnDefinition Width="Auto" />
  197. </Grid.ColumnDefinitions>
  198. <ContentPresenter Grid.Column="0"
  199. Margin="{TemplateBinding Padding}"
  200. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  201. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  202. RecognizesAccessKey="True"
  203. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  204. </Grid>
  205. </Border>
  206. </Grid>
  207. <ControlTemplate.Triggers>
  208. <Trigger Property="IsFocused" Value="True">
  209. <Setter TargetName="OutSideBorder" Property="Visibility" Value="Visible" />
  210. </Trigger>
  211. <!--
  212. <Trigger Property="IsPressed" Value="true">
  213. <Setter TargetName="CheckMark" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
  214. </Trigger>
  215. <Trigger Property="IsEnabled" Value="false">
  216. <Setter TargetName="CheckMark" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
  217. <Setter TargetName="CheckMarkPath" Property="Fill" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  218. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  219. </Trigger>
  220. -->
  221. </ControlTemplate.Triggers>
  222. </ControlTemplate>
  223. </Setter.Value>
  224. </Setter>
  225. </Style>
  226. </ResourceDictionary>