ExpanderStyle.xaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
  3. <Setter Property="Template">
  4. <Setter.Value>
  5. <ControlTemplate TargetType="{x:Type ToggleButton}">
  6. <Border Padding="{TemplateBinding Padding}">
  7. <Grid Background="Transparent" SnapsToDevicePixels="False">
  8. <Grid.ColumnDefinitions>
  9. <ColumnDefinition Width="auto" />
  10. <ColumnDefinition Width="19" />
  11. </Grid.ColumnDefinitions>
  12. <Path
  13. x:Name="arrow"
  14. Grid.Column="1"
  15. HorizontalAlignment="Center"
  16. VerticalAlignment="Center"
  17. Data="M4 5.00023L8.00012 0.000115851H-0.000115851L4 5.00023Z"
  18. Fill="#8F96A7"
  19. SnapsToDevicePixels="false"
  20. Visibility="Collapsed" />
  21. <Path
  22. x:Name="arrow2"
  23. Grid.Column="1"
  24. HorizontalAlignment="Center"
  25. VerticalAlignment="Center"
  26. Data="M5.00023 4L0.000115514 -0.000116188L0.000116188 8.00012L5.00023 4Z"
  27. Fill="#8F96A7"
  28. SnapsToDevicePixels="false" />
  29. <ContentPresenter
  30. Margin="4,0,0,0"
  31. HorizontalAlignment="Left"
  32. VerticalAlignment="Center"
  33. RecognizesAccessKey="True"
  34. SnapsToDevicePixels="True" />
  35. </Grid>
  36. </Border>
  37. <ControlTemplate.Triggers>
  38. <Trigger Property="IsChecked" Value="true">
  39. <Setter TargetName="arrow" Property="Visibility" Value="Visible" />
  40. <Setter TargetName="arrow2" Property="Visibility" Value="Collapsed" />
  41. </Trigger>
  42. <Trigger Property="IsMouseOver" Value="true" />
  43. <Trigger Property="IsPressed" Value="true" />
  44. <Trigger Property="IsEnabled" Value="false" />
  45. </ControlTemplate.Triggers>
  46. </ControlTemplate>
  47. </Setter.Value>
  48. </Setter>
  49. </Style>
  50. <Style x:Key="PromotionExpanderStyle" TargetType="{x:Type Expander}">
  51. <Setter Property="Background" Value="Transparent" />
  52. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
  53. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  54. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  55. <Setter Property="FontSize" Value="12" />
  56. <Setter Property="FontWeight" Value="SemiBold" />
  57. <Setter Property="FontFamily" Value="Segoe UI" />
  58. <Setter Property="BorderBrush" Value="Transparent" />
  59. <Setter Property="BorderThickness" Value="1" />
  60. <Setter Property="Template">
  61. <Setter.Value>
  62. <ControlTemplate TargetType="{x:Type Expander}">
  63. <Border
  64. Background="{TemplateBinding Background}"
  65. BorderBrush="{TemplateBinding BorderBrush}"
  66. BorderThickness="{TemplateBinding BorderThickness}"
  67. CornerRadius="3"
  68. SnapsToDevicePixels="true">
  69. <DockPanel>
  70. <ToggleButton
  71. x:Name="HeaderSite"
  72. MinWidth="0"
  73. MinHeight="0"
  74. Margin="1"
  75. Padding="{TemplateBinding Padding}"
  76. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  77. VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
  78. Content="{TemplateBinding Header}"
  79. ContentTemplate="{TemplateBinding HeaderTemplate}"
  80. ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
  81. DockPanel.Dock="Top"
  82. FontFamily="{TemplateBinding FontFamily}"
  83. FontSize="{TemplateBinding FontSize}"
  84. FontStretch="{TemplateBinding FontStretch}"
  85. FontStyle="{TemplateBinding FontStyle}"
  86. FontWeight="{TemplateBinding FontWeight}"
  87. Foreground="{TemplateBinding Foreground}"
  88. IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  89. Style="{StaticResource ExpanderDownHeaderStyle}" />
  90. <ContentPresenter
  91. x:Name="ExpandSite"
  92. Margin="{TemplateBinding Padding}"
  93. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  94. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  95. DockPanel.Dock="Bottom"
  96. Focusable="false"
  97. Visibility="Collapsed" />
  98. </DockPanel>
  99. </Border>
  100. <ControlTemplate.Triggers>
  101. <Trigger Property="IsExpanded" Value="true">
  102. <Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
  103. </Trigger>
  104. <Trigger Property="ExpandDirection" Value="Right">
  105. <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Right" />
  106. <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Left" />
  107. </Trigger>
  108. <Trigger Property="ExpandDirection" Value="Up">
  109. <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Top" />
  110. <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Bottom" />
  111. </Trigger>
  112. <Trigger Property="ExpandDirection" Value="Left">
  113. <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Left" />
  114. <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Right" />
  115. </Trigger>
  116. <Trigger Property="IsEnabled" Value="false" />
  117. </ControlTemplate.Triggers>
  118. </ControlTemplate>
  119. </Setter.Value>
  120. </Setter>
  121. </Style>
  122. <Style x:Key="ExpanderHeaderFocusVisual">
  123. <Setter Property="Control.Template">
  124. <Setter.Value>
  125. <ControlTemplate>
  126. <Border>
  127. <Rectangle
  128. Margin="0"
  129. SnapsToDevicePixels="true"
  130. Stroke="Black"
  131. StrokeDashArray="1 2"
  132. StrokeThickness="1" />
  133. </Border>
  134. </ControlTemplate>
  135. </Setter.Value>
  136. </Setter>
  137. </Style>
  138. <SolidColorBrush x:Key="Expander.MouseOver.Circle.Stroke" Color="#FF5593FF" />
  139. <SolidColorBrush x:Key="Expander.MouseOver.Circle.Fill" Color="#FFF3F9FF" />
  140. <SolidColorBrush x:Key="Expander.MouseOver.Arrow.Stroke" Color="#616469" />
  141. <SolidColorBrush x:Key="Expander.Pressed.Circle.Stroke" Color="#FF3C77DD" />
  142. <SolidColorBrush x:Key="Expander.Pressed.Circle.Fill" Color="#FFD9ECFF" />
  143. <SolidColorBrush x:Key="Expander.Pressed.Arrow.Stroke" Color="#616469" />
  144. <SolidColorBrush x:Key="Expander.Disabled.Circle.Stroke" Color="#FFBCBCBC" />
  145. <SolidColorBrush x:Key="Expander.Disabled.Circle.Fill" Color="#FFE6E6E6" />
  146. <SolidColorBrush x:Key="Expander.Disabled.Arrow.Stroke" Color="#FF707070" />
  147. <SolidColorBrush x:Key="Expander.Static.Circle.Fill" Color="#FFFFFFFF" />
  148. <SolidColorBrush x:Key="Expander.Static.Circle.Stroke" Color="#FF333333" />
  149. <SolidColorBrush x:Key="Expander.Static.Arrow.Stroke" Color="#FF333333" />
  150. <Style x:Key="GropExpanderStyle" TargetType="{x:Type ToggleButton}">
  151. <Setter Property="Template">
  152. <Setter.Value>
  153. <ControlTemplate TargetType="{x:Type ToggleButton}">
  154. <Border Padding="{TemplateBinding Padding}">
  155. <Grid Background="{StaticResource color.sys.layout.fg.light}" SnapsToDevicePixels="False">
  156. <Grid.ColumnDefinitions>
  157. <ColumnDefinition Width="*" />
  158. <ColumnDefinition Width="35" />
  159. </Grid.ColumnDefinitions>
  160. <Ellipse
  161. x:Name="circle"
  162. Width="19"
  163. Height="19"
  164. HorizontalAlignment="Center"
  165. VerticalAlignment="Center"
  166. Fill="{StaticResource Expander.Static.Circle.Fill}"
  167. Stroke="{StaticResource Expander.Static.Circle.Stroke}"
  168. Visibility="Collapsed" />
  169. <Rectangle Grid.Column="0" />
  170. <Path
  171. Name="arrowdown"
  172. Grid.Column="1"
  173. Margin="0,0,15,0"
  174. HorizontalAlignment="Right"
  175. VerticalAlignment="Center"
  176. Data="M6 7.56427L2.03039 3.59467L0.969727 4.65533L5.46967 9.15526C5.76256 9.44816 6.23743 9.44816 6.53033 9.15526L11.0303 4.65533L9.9696 3.59467L6 7.56427Z"
  177. Fill="Black" />
  178. <Path
  179. Name="Collapsed"
  180. Grid.Column="1"
  181. Margin="0,0,15,0"
  182. HorizontalAlignment="Right"
  183. VerticalAlignment="Center"
  184. Data="M7.56438 5.99999L3.59473 9.96964L4.65539 11.0303L9.15537 6.53032C9.44826 6.23743 9.44826 5.76255 9.15537 5.46966L4.65539 0.969675L3.59473 2.03033L7.56438 5.99999Z"
  185. Fill="Black" />
  186. <ContentPresenter
  187. Grid.Column="0"
  188. Margin="2,0,0,0"
  189. HorizontalAlignment="Stretch"
  190. VerticalAlignment="Center"
  191. RecognizesAccessKey="True"
  192. SnapsToDevicePixels="True" />
  193. </Grid>
  194. </Border>
  195. <ControlTemplate.Triggers>
  196. <Trigger Property="IsChecked" Value="true">
  197. <Setter TargetName="Collapsed" Property="Visibility" Value="Collapsed" />
  198. <Setter TargetName="arrowdown" Property="Visibility" Value="Visible" />
  199. </Trigger>
  200. <Trigger Property="IsChecked" Value="False">
  201. <Setter TargetName="Collapsed" Property="Visibility" Value="Visible" />
  202. <Setter TargetName="arrowdown" Property="Visibility" Value="Collapsed" />
  203. </Trigger>
  204. <Trigger Property="IsMouseOver" Value="true">
  205. <Setter TargetName="circle" Property="Stroke" Value="{StaticResource Expander.MouseOver.Circle.Stroke}" />
  206. <Setter TargetName="circle" Property="Fill" Value="{StaticResource Expander.MouseOver.Circle.Fill}" />
  207. <Setter TargetName="Collapsed" Property="Stroke" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
  208. <Setter TargetName="arrowdown" Property="Stroke" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
  209. </Trigger>
  210. <Trigger Property="IsPressed" Value="true">
  211. <Setter TargetName="circle" Property="Stroke" Value="{StaticResource Expander.Pressed.Circle.Stroke}" />
  212. <Setter TargetName="circle" Property="StrokeThickness" Value="1.5" />
  213. <Setter TargetName="circle" Property="Fill" Value="{StaticResource Expander.Pressed.Circle.Fill}" />
  214. <Setter TargetName="Collapsed" Property="Stroke" Value="{StaticResource Expander.Pressed.Arrow.Stroke}" />
  215. <Setter TargetName="arrowdown" Property="Stroke" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
  216. </Trigger>
  217. <Trigger Property="IsEnabled" Value="false">
  218. <Setter TargetName="circle" Property="Stroke" Value="{StaticResource Expander.Disabled.Circle.Stroke}" />
  219. <Setter TargetName="circle" Property="Fill" Value="{StaticResource Expander.Disabled.Circle.Fill}" />
  220. <Setter TargetName="Collapsed" Property="Stroke" Value="{StaticResource Expander.Disabled.Arrow.Stroke}" />
  221. <Setter TargetName="arrowdown" Property="Stroke" Value="{StaticResource Expander.Disabled.Arrow.Stroke}" />
  222. </Trigger>
  223. </ControlTemplate.Triggers>
  224. </ControlTemplate>
  225. </Setter.Value>
  226. </Setter>
  227. </Style>
  228. <Style x:Key="GropExpanderHeader" TargetType="{x:Type Expander}">
  229. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
  230. <Setter Property="Background" Value="{StaticResource color.sys.layout.mg}" />
  231. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  232. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  233. <Setter Property="BorderBrush" Value="Transparent" />
  234. <Setter Property="BorderThickness" Value="1" />
  235. <Setter Property="Template">
  236. <Setter.Value>
  237. <ControlTemplate TargetType="{x:Type Expander}">
  238. <Border
  239. Margin="0,2"
  240. Background="{TemplateBinding Background}"
  241. BorderBrush="{TemplateBinding BorderBrush}"
  242. BorderThickness="{TemplateBinding BorderThickness}"
  243. CornerRadius="4"
  244. SnapsToDevicePixels="true">
  245. <DockPanel>
  246. <ContentPresenter
  247. x:Name="ExpandSite"
  248. Margin="{TemplateBinding Padding}"
  249. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  250. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  251. DockPanel.Dock="Bottom"
  252. Focusable="false"
  253. Visibility="Collapsed" />
  254. <ToggleButton
  255. x:Name="HeaderSite"
  256. MinWidth="0"
  257. MinHeight="0"
  258. Margin="1"
  259. Padding="{TemplateBinding Padding}"
  260. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  261. VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
  262. Content="{TemplateBinding Header}"
  263. ContentTemplate="{TemplateBinding HeaderTemplate}"
  264. ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
  265. DockPanel.Dock="Top"
  266. FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}"
  267. FontFamily="{TemplateBinding FontFamily}"
  268. FontSize="{TemplateBinding FontSize}"
  269. FontStretch="{TemplateBinding FontStretch}"
  270. FontStyle="{TemplateBinding FontStyle}"
  271. FontWeight="{TemplateBinding FontWeight}"
  272. Foreground="{TemplateBinding Foreground}"
  273. IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  274. Style="{StaticResource GropExpanderStyle}" />
  275. </DockPanel>
  276. </Border>
  277. <ControlTemplate.Triggers>
  278. <Trigger Property="IsExpanded" Value="true">
  279. <Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
  280. </Trigger>
  281. <Trigger Property="IsExpanded" Value="false">
  282. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
  283. </Trigger>
  284. </ControlTemplate.Triggers>
  285. </ControlTemplate>
  286. </Setter.Value>
  287. </Setter>
  288. </Style>
  289. </ResourceDictionary>