You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

324 lines
19 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:system="clr-namespace:System;assembly=mscorlib">
  5. <ResourceDictionary.MergedDictionaries>
  6. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/RepeatButton.xaml" />
  7. </ResourceDictionary.MergedDictionaries>
  8. <Style x:Key="RubyerScrollBarArrowButton"
  9. BasedOn="{StaticResource TextRepeatButton}"
  10. TargetType="{x:Type RepeatButton}">
  11. <Setter Property="Focusable" Value="False" />
  12. <Setter Property="IsTabStop" Value="False" />
  13. <Setter Property="OverridesDefaultStyle" Value="True" />
  14. <Setter Property="SnapsToDevicePixels" Value="True" />
  15. <Setter Property="Cursor" Value="Arrow" />
  16. <Setter Property="Padding" Value="0" />
  17. <Setter Property="FontSize" Value="{Binding Path=(bpa:ScrollViewerHelper.ScrollBarSize), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  18. <Setter Property="HorizontalContentAlignment" Value="Center" />
  19. <Setter Property="VerticalContentAlignment" Value="Center" />
  20. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  21. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  22. <Setter Property="bpa:ControlHelper.MaskOpacity" Value="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  23. </Style>
  24. <Style x:Key="RubyerScrollBarPageButton" TargetType="{x:Type RepeatButton}">
  25. <Setter Property="Focusable" Value="False" />
  26. <Setter Property="IsTabStop" Value="False" />
  27. <Setter Property="OverridesDefaultStyle" Value="True" />
  28. <Setter Property="SnapsToDevicePixels" Value="True" />
  29. <Setter Property="Template">
  30. <Setter.Value>
  31. <ControlTemplate TargetType="{x:Type RepeatButton}">
  32. <Border Background="Transparent" />
  33. </ControlTemplate>
  34. </Setter.Value>
  35. </Setter>
  36. </Style>
  37. <Style x:Key="RubyerScrollBarThumb" TargetType="{x:Type Thumb}">
  38. <Setter Property="Focusable" Value="False" />
  39. <Setter Property="IsTabStop" Value="False" />
  40. <Setter Property="OverridesDefaultStyle" Value="True" />
  41. <Setter Property="SnapsToDevicePixels" Value="True" />
  42. <Setter Property="Template">
  43. <Setter.Value>
  44. <ControlTemplate TargetType="{x:Type Thumb}">
  45. <Grid Margin="1">
  46. <Border x:Name="border"
  47. Background="{TemplateBinding Background}"
  48. BorderBrush="{TemplateBinding BorderBrush}"
  49. BorderThickness="0"
  50. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=ScrollBar}}" />
  51. <bpa:ControlMask Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=ScrollBar}}"
  52. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=ScrollBar}}"
  53. IsActive="{TemplateBinding IsDragging}"
  54. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=ScrollBar}}" />
  55. </Grid>
  56. </ControlTemplate>
  57. </Setter.Value>
  58. </Setter>
  59. </Style>
  60. <ControlTemplate x:Key="RubyerVerticalScrollBar" TargetType="{x:Type ScrollBar}">
  61. <Grid x:Name="root">
  62. <Grid.RowDefinitions>
  63. <RowDefinition Height="Auto" />
  64. <RowDefinition Height="*" />
  65. <RowDefinition Height="Auto" />
  66. </Grid.RowDefinitions>
  67. <Grid.Tag>
  68. <system:Double>0.5</system:Double>
  69. </Grid.Tag>
  70. <Grid.Width>
  71. <MultiBinding Converter="{StaticResource MathMultiplyConverter}">
  72. <Binding Path="(bpa:ScrollViewerHelper.ScrollBarSize)" RelativeSource="{RelativeSource Mode=TemplatedParent}" />
  73. <Binding Path="Tag" RelativeSource="{RelativeSource Self}" />
  74. </MultiBinding>
  75. </Grid.Width>
  76. <Border Grid.RowSpan="3"
  77. Background="{TemplateBinding Background}"
  78. CornerRadius="{DynamicResource AllControlCornerRadius}" />
  79. <RepeatButton x:Name="upButton"
  80. Style="{StaticResource RubyerScrollBarArrowButton}"
  81. Grid.Row="0"
  82. Width="{TemplateBinding Width}"
  83. Height="{TemplateBinding Width}"
  84. Command="ScrollBar.LineUpCommand"
  85. Foreground="{Binding Path=(bpa:ScrollViewerHelper.ArrowIconBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  86. Visibility="Collapsed">
  87. <bpa:Icon Type="ArrowUpSLine" />
  88. </RepeatButton>
  89. <Track x:Name="PART_Track"
  90. Grid.Row="1"
  91. IsDirectionReversed="True">
  92. <Track.DecreaseRepeatButton>
  93. <RepeatButton Style="{StaticResource RubyerScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
  94. </Track.DecreaseRepeatButton>
  95. <Track.Thumb>
  96. <Thumb Style="{StaticResource RubyerScrollBarThumb}" Background="{Binding Path=(bpa:ScrollViewerHelper.ScrollBarForeground), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  97. </Track.Thumb>
  98. <Track.IncreaseRepeatButton>
  99. <RepeatButton Style="{StaticResource RubyerScrollBarPageButton}" Command="ScrollBar.PageDownCommand" />
  100. </Track.IncreaseRepeatButton>
  101. </Track>
  102. <RepeatButton x:Name="downButton"
  103. Style="{StaticResource RubyerScrollBarArrowButton}"
  104. Grid.Row="2"
  105. Width="{TemplateBinding Width}"
  106. Height="{TemplateBinding Width}"
  107. Command="ScrollBar.LineDownCommand"
  108. Foreground="{Binding Path=(bpa:ScrollViewerHelper.ArrowIconBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  109. Visibility="Collapsed">
  110. <bpa:Icon Type="ArrowDownSLine" />
  111. </RepeatButton>
  112. </Grid>
  113. <ControlTemplate.Triggers>
  114. <MultiDataTrigger>
  115. <MultiDataTrigger.Conditions>
  116. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True" />
  117. <Condition Binding="{Binding Path=(bpa:ScrollViewerHelper.ShowArrowButton), RelativeSource={RelativeSource Self}}" Value="True" />
  118. </MultiDataTrigger.Conditions>
  119. <Setter TargetName="upButton" Property="Visibility" Value="Visible" />
  120. <Setter TargetName="downButton" Property="Visibility" Value="Visible" />
  121. </MultiDataTrigger>
  122. <MultiTrigger>
  123. <MultiTrigger.Conditions>
  124. <Condition Property="bpa:ScrollViewerHelper.ShowArrowButton" Value="True" />
  125. <Condition Property="bpa:ScrollViewerHelper.IsDynamicBarSize" Value="False" />
  126. </MultiTrigger.Conditions>
  127. <Setter TargetName="upButton" Property="Visibility" Value="Visible" />
  128. <Setter TargetName="downButton" Property="Visibility" Value="Visible" />
  129. </MultiTrigger>
  130. <MultiTrigger>
  131. <MultiTrigger.Conditions>
  132. <Condition Property="Orientation" Value="Vertical" />
  133. <Condition Property="IsMouseOver" Value="True" />
  134. <Condition Property="bpa:ScrollViewerHelper.IsDynamicBarSize" Value="True" />
  135. </MultiTrigger.Conditions>
  136. <MultiTrigger.EnterActions>
  137. <BeginStoryboard>
  138. <Storyboard>
  139. <DoubleAnimation Storyboard.TargetName="root"
  140. Storyboard.TargetProperty="Tag"
  141. To="1"
  142. Duration="0:0:0.3">
  143. <DoubleAnimation.EasingFunction>
  144. <CubicEase EasingMode="EaseOut" />
  145. </DoubleAnimation.EasingFunction>
  146. </DoubleAnimation>
  147. </Storyboard>
  148. </BeginStoryboard>
  149. </MultiTrigger.EnterActions>
  150. <MultiTrigger.ExitActions>
  151. <BeginStoryboard>
  152. <Storyboard>
  153. <DoubleAnimation Storyboard.TargetName="root"
  154. Storyboard.TargetProperty="Tag"
  155. To="0.5"
  156. Duration="0:0:0.3">
  157. <DoubleAnimation.EasingFunction>
  158. <CubicEase EasingMode="EaseOut" />
  159. </DoubleAnimation.EasingFunction>
  160. </DoubleAnimation>
  161. </Storyboard>
  162. </BeginStoryboard>
  163. </MultiTrigger.ExitActions>
  164. </MultiTrigger>
  165. <Trigger Property="bpa:ScrollViewerHelper.IsDynamicBarSize" Value="False">
  166. <Setter TargetName="root" Property="Tag" Value="1" />
  167. </Trigger>
  168. </ControlTemplate.Triggers>
  169. </ControlTemplate>
  170. <ControlTemplate x:Key="RubyerHorizontalScrollBar" TargetType="{x:Type ScrollBar}">
  171. <Grid x:Name="root">
  172. <Grid.ColumnDefinitions>
  173. <ColumnDefinition Width="Auto" />
  174. <ColumnDefinition Width="*" />
  175. <ColumnDefinition Width="Auto" />
  176. </Grid.ColumnDefinitions>
  177. <Grid.Tag>
  178. <system:Double>0.5</system:Double>
  179. </Grid.Tag>
  180. <Grid.Height>
  181. <MultiBinding Converter="{StaticResource MathMultiplyConverter}">
  182. <Binding Path="(bpa:ScrollViewerHelper.ScrollBarSize)" RelativeSource="{RelativeSource Mode=TemplatedParent}" />
  183. <Binding Path="Tag" RelativeSource="{RelativeSource Self}" />
  184. </MultiBinding>
  185. </Grid.Height>
  186. <Border Grid.ColumnSpan="3"
  187. Background="{TemplateBinding Background}"
  188. CornerRadius="{DynamicResource AllControlCornerRadius}" />
  189. <RepeatButton x:Name="leftButton"
  190. Style="{StaticResource RubyerScrollBarArrowButton}"
  191. Grid.Column="0"
  192. Width="{TemplateBinding Height}"
  193. Height="{TemplateBinding Height}"
  194. Command="ScrollBar.LineLeftCommand"
  195. Foreground="{Binding Path=(bpa:ScrollViewerHelper.ArrowIconBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  196. Visibility="Collapsed">
  197. <bpa:Icon Type="ArrowLeftSLine" />
  198. </RepeatButton>
  199. <Track x:Name="PART_Track"
  200. Grid.Column="1"
  201. IsDirectionReversed="False">
  202. <Track.DecreaseRepeatButton>
  203. <RepeatButton Style="{StaticResource RubyerScrollBarPageButton}" Command="ScrollBar.PageLeftCommand" />
  204. </Track.DecreaseRepeatButton>
  205. <Track.Thumb>
  206. <Thumb Style="{StaticResource RubyerScrollBarThumb}" Background="{Binding Path=(bpa:ScrollViewerHelper.ScrollBarForeground), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  207. </Track.Thumb>
  208. <Track.IncreaseRepeatButton>
  209. <RepeatButton Style="{StaticResource RubyerScrollBarPageButton}" Command="ScrollBar.PageRightCommand" />
  210. </Track.IncreaseRepeatButton>
  211. </Track>
  212. <RepeatButton x:Name="rightButton"
  213. Style="{StaticResource RubyerScrollBarArrowButton}"
  214. Grid.Column="2"
  215. Width="{TemplateBinding Height}"
  216. Height="{TemplateBinding Height}"
  217. Command="ScrollBar.LineRightCommand"
  218. Cursor="Arrow"
  219. Foreground="{Binding Path=(bpa:ScrollViewerHelper.ArrowIconBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  220. Visibility="Collapsed">
  221. <bpa:Icon Type="ArrowRightSLine" />
  222. </RepeatButton>
  223. </Grid>
  224. <ControlTemplate.Triggers>
  225. <MultiDataTrigger>
  226. <MultiDataTrigger.Conditions>
  227. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True" />
  228. <Condition Binding="{Binding Path=(bpa:ScrollViewerHelper.ShowArrowButton), RelativeSource={RelativeSource Self}}" Value="True" />
  229. </MultiDataTrigger.Conditions>
  230. <Setter TargetName="leftButton" Property="Visibility" Value="Visible" />
  231. <Setter TargetName="rightButton" Property="Visibility" Value="Visible" />
  232. </MultiDataTrigger>
  233. <MultiTrigger>
  234. <MultiTrigger.Conditions>
  235. <Condition Property="bpa:ScrollViewerHelper.ShowArrowButton" Value="True" />
  236. <Condition Property="bpa:ScrollViewerHelper.IsDynamicBarSize" Value="False" />
  237. </MultiTrigger.Conditions>
  238. <Setter TargetName="leftButton" Property="Visibility" Value="Visible" />
  239. <Setter TargetName="rightButton" Property="Visibility" Value="Visible" />
  240. </MultiTrigger>
  241. <MultiTrigger>
  242. <MultiTrigger.Conditions>
  243. <Condition Property="Orientation" Value="Horizontal" />
  244. <Condition Property="IsMouseOver" Value="True" />
  245. <Condition Property="bpa:ScrollViewerHelper.IsDynamicBarSize" Value="True" />
  246. </MultiTrigger.Conditions>
  247. <MultiTrigger.EnterActions>
  248. <BeginStoryboard>
  249. <Storyboard>
  250. <DoubleAnimation Storyboard.TargetName="root"
  251. Storyboard.TargetProperty="Tag"
  252. To="1"
  253. Duration="0:0:0.3">
  254. <DoubleAnimation.EasingFunction>
  255. <CubicEase EasingMode="EaseOut" />
  256. </DoubleAnimation.EasingFunction>
  257. </DoubleAnimation>
  258. </Storyboard>
  259. </BeginStoryboard>
  260. </MultiTrigger.EnterActions>
  261. <MultiTrigger.ExitActions>
  262. <BeginStoryboard>
  263. <Storyboard>
  264. <DoubleAnimation Storyboard.TargetName="root"
  265. Storyboard.TargetProperty="Tag"
  266. To="0.5"
  267. Duration="0:0:0.3">
  268. <DoubleAnimation.EasingFunction>
  269. <CubicEase EasingMode="EaseOut" />
  270. </DoubleAnimation.EasingFunction>
  271. </DoubleAnimation>
  272. </Storyboard>
  273. </BeginStoryboard>
  274. </MultiTrigger.ExitActions>
  275. </MultiTrigger>
  276. <Trigger Property="bpa:ScrollViewerHelper.IsDynamicBarSize" Value="False">
  277. <Setter TargetName="root" Property="Tag" Value="1" />
  278. </Trigger>
  279. </ControlTemplate.Triggers>
  280. </ControlTemplate>
  281. <Style x:Key="RubyerScrollBar" TargetType="{x:Type ScrollBar}">
  282. <Setter Property="Background" Value="{Binding Path=(bpa:ScrollViewerHelper.ScrollBarBackground), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  283. <Setter Property="OverridesDefaultStyle" Value="True" />
  284. <Setter Property="SnapsToDevicePixels" Value="True" />
  285. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  286. <Setter Property="bpa:ControlHelper.MaskOpacity" Value="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  287. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  288. <Setter Property="bpa:ScrollViewerHelper.ScrollBarForeground" Value="{Binding Path=(bpa:ScrollViewerHelper.ScrollBarForeground), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  289. <Setter Property="bpa:ScrollViewerHelper.ShowArrowButton" Value="{Binding Path=(bpa:ScrollViewerHelper.ShowArrowButton), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  290. <Setter Property="bpa:ScrollViewerHelper.ArrowIconBrush" Value="{Binding Path=(bpa:ScrollViewerHelper.ArrowIconBrush), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  291. <Setter Property="bpa:ScrollViewerHelper.ScrollBarSize" Value="{Binding Path=(bpa:ScrollViewerHelper.ScrollBarSize), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  292. <Setter Property="bpa:ScrollViewerHelper.IsDynamicBarSize" Value="{Binding Path=(bpa:ScrollViewerHelper.IsDynamicBarSize), RelativeSource={RelativeSource AncestorType=ScrollViewer}}" />
  293. <Style.Triggers>
  294. <Trigger Property="Orientation" Value="Horizontal">
  295. <Setter Property="Template" Value="{StaticResource RubyerHorizontalScrollBar}" />
  296. <Setter Property="Width" Value="Auto" />
  297. </Trigger>
  298. <Trigger Property="Orientation" Value="Vertical">
  299. <Setter Property="Height" Value="Auto" />
  300. <Setter Property="Template" Value="{StaticResource RubyerVerticalScrollBar}" />
  301. </Trigger>
  302. </Style.Triggers>
  303. </Style>
  304. </ResourceDictionary>