ExpanderStyle.xaml 18 KB

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