您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

435 行
30 KiB

  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:bpa="clr-namespace:BPA.UIControl"
  4. xmlns:converter="clr-namespace:BPA.UIControl.Converters">
  5. <ResourceDictionary.MergedDictionaries>
  6. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/Resources/Default.xaml" />
  7. </ResourceDictionary.MergedDictionaries>
  8. <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
  9. <Setter Property="Template">
  10. <Setter.Value>
  11. <ControlTemplate TargetType="{x:Type ToggleButton}">
  12. <Grid>
  13. <Border x:Name="border"
  14. Padding="{TemplateBinding Padding}"
  15. Background="{TemplateBinding Background}">
  16. <Border.CornerRadius>
  17. <MultiBinding Converter="{StaticResource InsideCornerRadiusConverter}">
  18. <MultiBinding.Bindings>
  19. <Binding Path="BorderThickness" RelativeSource="{RelativeSource AncestorType=Border}" />
  20. <Binding Path="CornerRadius" RelativeSource="{RelativeSource AncestorType=Border}" />
  21. </MultiBinding.Bindings>
  22. </MultiBinding>
  23. </Border.CornerRadius>
  24. <DockPanel>
  25. <bpa:Icon x:Name="arrow"
  26. Grid.Column="1"
  27. DockPanel.Dock="{Binding Path=(bpa:ExpanderHelper.ExpandIconDock), RelativeSource={RelativeSource AncestorType=Expander}}"
  28. Foreground="{TemplateBinding Foreground}"
  29. RenderTransformOrigin="0.5 0.5"
  30. Type="{Binding Path=(bpa:ExpanderHelper.ExpandIconType), RelativeSource={RelativeSource AncestorType=Expander}}">
  31. <bpa:Icon.RenderTransform>
  32. <RotateTransform x:Name="arrowAngle" Angle="0" />
  33. </bpa:Icon.RenderTransform>
  34. </bpa:Icon>
  35. <ContentPresenter Margin="4 0 0 0"
  36. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  37. VerticalAlignment="Center"
  38. RecognizesAccessKey="True"
  39. SnapsToDevicePixels="True" />
  40. </DockPanel>
  41. </Border>
  42. <bpa:ControlMask Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=Expander}}"
  43. CornerRadius="{Binding CornerRadius, ElementName=border}"
  44. IsActive="{TemplateBinding IsPressed}"
  45. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=Expander}}" />
  46. </Grid>
  47. <ControlTemplate.Triggers>
  48. <Trigger Property="IsChecked" Value="true">
  49. <Trigger.EnterActions>
  50. <BeginStoryboard>
  51. <Storyboard>
  52. <DoubleAnimation Storyboard.TargetName="arrowAngle"
  53. Storyboard.TargetProperty="Angle"
  54. To="180"
  55. Duration="0:0:0.3">
  56. <DoubleAnimation.EasingFunction>
  57. <CubicEase EasingMode="EaseOut" />
  58. </DoubleAnimation.EasingFunction>
  59. </DoubleAnimation>
  60. </Storyboard>
  61. </BeginStoryboard>
  62. </Trigger.EnterActions>
  63. <Trigger.ExitActions>
  64. <BeginStoryboard>
  65. <Storyboard>
  66. <DoubleAnimation Storyboard.TargetName="arrowAngle"
  67. Storyboard.TargetProperty="Angle"
  68. To="0"
  69. Duration="0:0:0.3">
  70. <DoubleAnimation.EasingFunction>
  71. <CubicEase EasingMode="EaseOut" />
  72. </DoubleAnimation.EasingFunction>
  73. </DoubleAnimation>
  74. </Storyboard>
  75. </BeginStoryboard>
  76. </Trigger.ExitActions>
  77. </Trigger>
  78. </ControlTemplate.Triggers>
  79. </ControlTemplate>
  80. </Setter.Value>
  81. </Setter>
  82. </Style>
  83. <Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}">
  84. <Setter Property="Template">
  85. <Setter.Value>
  86. <ControlTemplate TargetType="{x:Type ToggleButton}">
  87. <Grid>
  88. <Border x:Name="border"
  89. Padding="{TemplateBinding Padding}"
  90. Background="{TemplateBinding Background}">
  91. <Border.CornerRadius>
  92. <MultiBinding Converter="{StaticResource InsideCornerRadiusConverter}">
  93. <MultiBinding.Bindings>
  94. <Binding Path="BorderThickness" RelativeSource="{RelativeSource AncestorType=Border}" />
  95. <Binding Path="CornerRadius" RelativeSource="{RelativeSource AncestorType=Border}" />
  96. </MultiBinding.Bindings>
  97. </MultiBinding>
  98. </Border.CornerRadius>
  99. <DockPanel>
  100. <bpa:Icon x:Name="arrow"
  101. Grid.Column="1"
  102. DockPanel.Dock="{Binding Path=(bpa:ExpanderHelper.ExpandIconDock), RelativeSource={RelativeSource AncestorType=Expander}}"
  103. Foreground="{TemplateBinding Foreground}"
  104. RenderTransformOrigin="0.5 0.5"
  105. Type="{Binding Path=(bpa:ExpanderHelper.ExpandIconType), RelativeSource={RelativeSource AncestorType=Expander}}">
  106. <bpa:Icon.RenderTransform>
  107. <RotateTransform x:Name="arrowAngle" Angle="0" />
  108. </bpa:Icon.RenderTransform>
  109. </bpa:Icon>
  110. <ContentPresenter Margin="4 0 0 0"
  111. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  112. VerticalAlignment="Center"
  113. RecognizesAccessKey="True"
  114. SnapsToDevicePixels="True" />
  115. </DockPanel>
  116. </Border>
  117. <bpa:ControlMask Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=Expander}}"
  118. CornerRadius="{Binding CornerRadius, ElementName=border}"
  119. IsActive="{TemplateBinding IsPressed}"
  120. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=Expander}}" />
  121. </Grid>
  122. <ControlTemplate.Triggers>
  123. <Trigger Property="IsChecked" Value="true">
  124. <Trigger.EnterActions>
  125. <BeginStoryboard>
  126. <Storyboard>
  127. <DoubleAnimation Storyboard.TargetName="arrowAngle"
  128. Storyboard.TargetProperty="Angle"
  129. To="0"
  130. Duration="0:0:0.3">
  131. <DoubleAnimation.EasingFunction>
  132. <CubicEase EasingMode="EaseOut" />
  133. </DoubleAnimation.EasingFunction>
  134. </DoubleAnimation>
  135. </Storyboard>
  136. </BeginStoryboard>
  137. </Trigger.EnterActions>
  138. <Trigger.ExitActions>
  139. <BeginStoryboard>
  140. <Storyboard>
  141. <DoubleAnimation Storyboard.TargetName="arrowAngle"
  142. Storyboard.TargetProperty="Angle"
  143. To="180"
  144. Duration="0:0:0.3">
  145. <DoubleAnimation.EasingFunction>
  146. <CubicEase EasingMode="EaseOut" />
  147. </DoubleAnimation.EasingFunction>
  148. </DoubleAnimation>
  149. </Storyboard>
  150. </BeginStoryboard>
  151. </Trigger.ExitActions>
  152. </Trigger>
  153. </ControlTemplate.Triggers>
  154. </ControlTemplate>
  155. </Setter.Value>
  156. </Setter>
  157. </Style>
  158. <Style x:Key="ExpanderLeftHeaderStyle" TargetType="{x:Type ToggleButton}">
  159. <Setter Property="Template">
  160. <Setter.Value>
  161. <ControlTemplate TargetType="{x:Type ToggleButton}">
  162. <Grid>
  163. <Border x:Name="border"
  164. Padding="{TemplateBinding Padding}"
  165. Background="{TemplateBinding Background}">
  166. <Border.CornerRadius>
  167. <MultiBinding Converter="{StaticResource InsideCornerRadiusConverter}">
  168. <MultiBinding.Bindings>
  169. <Binding Path="BorderThickness" RelativeSource="{RelativeSource AncestorType=Border}" />
  170. <Binding Path="CornerRadius" RelativeSource="{RelativeSource AncestorType=Border}" />
  171. </MultiBinding.Bindings>
  172. </MultiBinding>
  173. </Border.CornerRadius>
  174. <DockPanel>
  175. <bpa:Icon x:Name="arrow"
  176. Grid.Row="1"
  177. DockPanel.Dock="{Binding Path=(bpa:ExpanderHelper.ExpandIconDock), RelativeSource={RelativeSource AncestorType=Expander}}"
  178. Foreground="{TemplateBinding Foreground}"
  179. RenderTransformOrigin="0.5 0.5"
  180. Type="{Binding Path=(bpa:ExpanderHelper.ExpandIconType), RelativeSource={RelativeSource AncestorType=Expander}}">
  181. <bpa:Icon.RenderTransform>
  182. <RotateTransform x:Name="arrowAngle" Angle="90" />
  183. </bpa:Icon.RenderTransform>
  184. </bpa:Icon>
  185. <ContentPresenter Margin="0 4 0 0"
  186. HorizontalAlignment="Center"
  187. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  188. RecognizesAccessKey="True"
  189. SnapsToDevicePixels="True" />
  190. </DockPanel>
  191. </Border>
  192. <bpa:ControlMask Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=Expander}}"
  193. CornerRadius="{Binding CornerRadius, ElementName=border}"
  194. IsActive="{TemplateBinding IsPressed}"
  195. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=Expander}}" />
  196. </Grid>
  197. <ControlTemplate.Triggers>
  198. <Trigger Property="IsChecked" Value="true">
  199. <Trigger.EnterActions>
  200. <BeginStoryboard>
  201. <Storyboard>
  202. <DoubleAnimation Storyboard.TargetName="arrowAngle"
  203. Storyboard.TargetProperty="Angle"
  204. To="-90"
  205. Duration="0:0:0.3">
  206. <DoubleAnimation.EasingFunction>
  207. <CubicEase EasingMode="EaseOut" />
  208. </DoubleAnimation.EasingFunction>
  209. </DoubleAnimation>
  210. </Storyboard>
  211. </BeginStoryboard>
  212. </Trigger.EnterActions>
  213. <Trigger.ExitActions>
  214. <BeginStoryboard>
  215. <Storyboard>
  216. <DoubleAnimation Storyboard.TargetName="arrowAngle"
  217. Storyboard.TargetProperty="Angle"
  218. To="90"
  219. Duration="0:0:0.3">
  220. <DoubleAnimation.EasingFunction>
  221. <CubicEase EasingMode="EaseOut" />
  222. </DoubleAnimation.EasingFunction>
  223. </DoubleAnimation>
  224. </Storyboard>
  225. </BeginStoryboard>
  226. </Trigger.ExitActions>
  227. </Trigger>
  228. </ControlTemplate.Triggers>
  229. </ControlTemplate>
  230. </Setter.Value>
  231. </Setter>
  232. </Style>
  233. <Style x:Key="ExpanderRightHeaderStyle" TargetType="{x:Type ToggleButton}">
  234. <Setter Property="Template">
  235. <Setter.Value>
  236. <ControlTemplate TargetType="{x:Type ToggleButton}">
  237. <Grid>
  238. <Border x:Name="border"
  239. Padding="{TemplateBinding Padding}"
  240. Background="{TemplateBinding Background}">
  241. <Border.CornerRadius>
  242. <MultiBinding Converter="{StaticResource InsideCornerRadiusConverter}">
  243. <MultiBinding.Bindings>
  244. <Binding Path="BorderThickness" RelativeSource="{RelativeSource AncestorType=Border}" />
  245. <Binding Path="CornerRadius" RelativeSource="{RelativeSource AncestorType=Border}" />
  246. </MultiBinding.Bindings>
  247. </MultiBinding>
  248. </Border.CornerRadius>
  249. <DockPanel>
  250. <bpa:Icon x:Name="arrow"
  251. Grid.Row="1"
  252. DockPanel.Dock="{Binding Path=(bpa:ExpanderHelper.ExpandIconDock), RelativeSource={RelativeSource AncestorType=Expander}}"
  253. Foreground="{TemplateBinding Foreground}"
  254. RenderTransformOrigin="0.5 0.5"
  255. Type="{Binding Path=(bpa:ExpanderHelper.ExpandIconType), RelativeSource={RelativeSource AncestorType=Expander}}">
  256. <bpa:Icon.RenderTransform>
  257. <RotateTransform x:Name="arrowAngle" Angle="-90" />
  258. </bpa:Icon.RenderTransform>
  259. </bpa:Icon>
  260. <ContentPresenter Margin="0 4 0 0"
  261. HorizontalAlignment="Center"
  262. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  263. RecognizesAccessKey="True"
  264. SnapsToDevicePixels="True" />
  265. </DockPanel>
  266. </Border>
  267. <bpa:ControlMask Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=Expander}}"
  268. CornerRadius="{Binding CornerRadius, ElementName=border}"
  269. IsActive="{TemplateBinding IsPressed}"
  270. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=Expander}}" />
  271. </Grid>
  272. <ControlTemplate.Triggers>
  273. <Trigger Property="IsChecked" Value="true">
  274. <Trigger.EnterActions>
  275. <BeginStoryboard>
  276. <Storyboard>
  277. <DoubleAnimation Storyboard.TargetName="arrowAngle"
  278. Storyboard.TargetProperty="Angle"
  279. To="90"
  280. Duration="0:0:0.3">
  281. <DoubleAnimation.EasingFunction>
  282. <CubicEase EasingMode="EaseOut" />
  283. </DoubleAnimation.EasingFunction>
  284. </DoubleAnimation>
  285. </Storyboard>
  286. </BeginStoryboard>
  287. </Trigger.EnterActions>
  288. <Trigger.ExitActions>
  289. <BeginStoryboard>
  290. <Storyboard>
  291. <DoubleAnimation Storyboard.TargetName="arrowAngle"
  292. Storyboard.TargetProperty="Angle"
  293. To="-90"
  294. Duration="0:0:0.3">
  295. <DoubleAnimation.EasingFunction>
  296. <CubicEase EasingMode="EaseOut" />
  297. </DoubleAnimation.EasingFunction>
  298. </DoubleAnimation>
  299. </Storyboard>
  300. </BeginStoryboard>
  301. </Trigger.ExitActions>
  302. </Trigger>
  303. </ControlTemplate.Triggers>
  304. </ControlTemplate>
  305. </Setter.Value>
  306. </Setter>
  307. </Style>
  308. <Style x:Key="RubyerExpander" TargetType="{x:Type Expander}">
  309. <Setter Property="Background" Value="{DynamicResource DefaultBackground}" />
  310. <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
  311. <Setter Property="BorderThickness" Value="{DynamicResource DefaultBorderThickness}" />
  312. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  313. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  314. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  315. <Setter Property="SnapsToDevicePixels" Value="True" />
  316. <Setter Property="Padding" Value="5" />
  317. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{DynamicResource Mask}" />
  318. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllContainerCornerRadius}" />
  319. <Setter Property="bpa:HeaderHelper.Background" Value="{DynamicResource DefaultBackground}" />
  320. <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource DefaultForeground}" />
  321. <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}" />
  322. <Setter Property="bpa:HeaderHelper.FontWeight" Value="Normal" />
  323. <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Left" />
  324. <Setter Property="bpa:HeaderHelper.VerticalAlignment" Value="Top" />
  325. <Setter Property="bpa:HeaderHelper.Padding" Value="5" />
  326. <Setter Property="bpa:ExpanderHelper.ExpandIconType" Value="ArrowDownSLine" />
  327. <Setter Property="Template">
  328. <Setter.Value>
  329. <ControlTemplate TargetType="{x:Type Expander}">
  330. <Border x:Name="border"
  331. Background="{TemplateBinding Background}"
  332. BorderBrush="{TemplateBinding BorderBrush}"
  333. BorderThickness="{TemplateBinding BorderThickness}"
  334. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  335. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  336. <DockPanel>
  337. <ToggleButton x:Name="HeaderSite"
  338. Style="{StaticResource ExpanderDownHeaderStyle}"
  339. MinWidth="0"
  340. MinHeight="0"
  341. Padding="{Binding Path=(bpa:HeaderHelper.Padding), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  342. HorizontalContentAlignment="{Binding Path=(bpa:HeaderHelper.HorizontalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  343. VerticalContentAlignment="{Binding Path=(bpa:HeaderHelper.VerticalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  344. Background="{Binding Path=(bpa:HeaderHelper.Background), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  345. Content="{TemplateBinding Header}"
  346. ContentTemplate="{TemplateBinding HeaderTemplate}"
  347. ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
  348. DockPanel.Dock="Top"
  349. FocusVisualStyle="{StaticResource FocusVisual}"
  350. FontFamily="{Binding Path=(bpa:HeaderHelper.FontFamily), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  351. FontSize="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  352. FontStretch="{TemplateBinding FontStretch}"
  353. FontStyle="{TemplateBinding FontStyle}"
  354. FontWeight="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  355. Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  356. IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" />
  357. <bpa:Transition x:Name="Transition"
  358. IsShow="{TemplateBinding IsExpanded}"
  359. Type="CollapseUp">
  360. <ContentPresenter x:Name="ExpandSite"
  361. Margin="{TemplateBinding Padding}"
  362. Focusable="false" />
  363. </bpa:Transition>
  364. </DockPanel>
  365. </Border>
  366. <ControlTemplate.Triggers>
  367. <Trigger Property="IsExpanded" Value="True">
  368. <Trigger.EnterActions>
  369. <BeginStoryboard>
  370. <Storyboard>
  371. <DoubleAnimation Storyboard.TargetName="ExpandSite"
  372. Storyboard.TargetProperty="Opacity"
  373. From="0"
  374. To="1"
  375. Duration="0:0:0.3">
  376. <DoubleAnimation.EasingFunction>
  377. <CubicEase EasingMode="EaseIn" />
  378. </DoubleAnimation.EasingFunction>
  379. </DoubleAnimation>
  380. </Storyboard>
  381. </BeginStoryboard>
  382. </Trigger.EnterActions>
  383. <Trigger.ExitActions>
  384. <BeginStoryboard>
  385. <Storyboard>
  386. <DoubleAnimation Storyboard.TargetName="ExpandSite"
  387. Storyboard.TargetProperty="Opacity"
  388. From="1"
  389. To="0"
  390. Duration="0:0:0.3">
  391. <DoubleAnimation.EasingFunction>
  392. <CubicEase EasingMode="EaseOut" />
  393. </DoubleAnimation.EasingFunction>
  394. </DoubleAnimation>
  395. </Storyboard>
  396. </BeginStoryboard>
  397. </Trigger.ExitActions>
  398. </Trigger>
  399. <Trigger Property="ExpandDirection" Value="Right">
  400. <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Right" />
  401. <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Left" />
  402. <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderRightHeaderStyle}" />
  403. <Setter TargetName="Transition" Property="Type" Value="CollapseLeft" />
  404. <Setter Property="bpa:ExpanderHelper.ExpandIconDock" Value="Bottom" />
  405. </Trigger>
  406. <Trigger Property="ExpandDirection" Value="Up">
  407. <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Top" />
  408. <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Bottom" />
  409. <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderUpHeaderStyle}" />
  410. </Trigger>
  411. <Trigger Property="ExpandDirection" Value="Left">
  412. <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Left" />
  413. <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Right" />
  414. <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderLeftHeaderStyle}" />
  415. <Setter TargetName="Transition" Property="Type" Value="CollapseLeft" />
  416. <Setter Property="bpa:ExpanderHelper.ExpandIconDock" Value="Bottom" />
  417. </Trigger>
  418. <Trigger Property="IsEnabled" Value="false">
  419. <Setter TargetName="border" Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  420. </Trigger>
  421. </ControlTemplate.Triggers>
  422. </ControlTemplate>
  423. </Setter.Value>
  424. </Setter>
  425. </Style>
  426. </ResourceDictionary>