Scroll.xaml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. 
  2. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  4. <ResourceDictionary.MergedDictionaries>
  5. <ResourceDictionary Source="/Resources/Common/Colors.xaml"/>
  6. </ResourceDictionary.MergedDictionaries>
  7. <Style x:Key="ScrollBarLineButton"
  8. TargetType="{x:Type RepeatButton}">
  9. <Setter Property="SnapsToDevicePixels"
  10. Value="True" />
  11. <Setter Property="OverridesDefaultStyle"
  12. Value="true" />
  13. <Setter Property="Focusable"
  14. Value="false" />
  15. <Setter Property="Template">
  16. <Setter.Value>
  17. <ControlTemplate TargetType="{x:Type RepeatButton}">
  18. <Border x:Name="Border"
  19. Margin="1"
  20. CornerRadius="2"
  21. BorderThickness="1">
  22. <Border.BorderBrush>
  23. <LinearGradientBrush StartPoint="0,0"
  24. EndPoint="0,1">
  25. <LinearGradientBrush.GradientStops>
  26. <GradientStopCollection>
  27. <GradientStop Color="{DynamicResource BorderMediumColor}"
  28. Offset="0.0" />
  29. <GradientStop Color="{DynamicResource BorderDarkColor}"
  30. Offset="1.0" />
  31. </GradientStopCollection>
  32. </LinearGradientBrush.GradientStops>
  33. </LinearGradientBrush>
  34. </Border.BorderBrush>
  35. <Border.Background>
  36. <LinearGradientBrush StartPoint="0,0"
  37. EndPoint="0,1">
  38. <LinearGradientBrush.GradientStops>
  39. <GradientStopCollection>
  40. <GradientStop Color="{DynamicResource ControlLightColor}"/>
  41. <GradientStop Color="{DynamicResource ControlMediumColor}"
  42. Offset="1.0" />
  43. </GradientStopCollection>
  44. </LinearGradientBrush.GradientStops>
  45. </LinearGradientBrush>
  46. </Border.Background>
  47. <VisualStateManager.VisualStateGroups>
  48. <VisualStateGroup x:Name="CommonStates">
  49. <VisualState x:Name="Normal" />
  50. <VisualState x:Name="MouseOver" />
  51. <VisualState x:Name="Pressed">
  52. <Storyboard>
  53. <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
  54. Storyboard.TargetProperty="(Panel.Background).
  55. (GradientBrush.GradientStops)[1].(GradientStop.Color)">
  56. <EasingColorKeyFrame KeyTime="0"
  57. Value="Blue" />
  58. </ColorAnimationUsingKeyFrames>
  59. </Storyboard>
  60. </VisualState>
  61. <VisualState x:Name="Disabled">
  62. <Storyboard>
  63. <ColorAnimationUsingKeyFrames Storyboard.TargetName="Arrow"
  64. Storyboard.TargetProperty="(Shape.Fill).
  65. (SolidColorBrush.Color)">
  66. <EasingColorKeyFrame KeyTime="0"
  67. Value="Blue" />
  68. </ColorAnimationUsingKeyFrames>
  69. </Storyboard>
  70. </VisualState>
  71. </VisualStateGroup>
  72. </VisualStateManager.VisualStateGroups>
  73. <Path x:Name="Arrow"
  74. HorizontalAlignment="Center"
  75. VerticalAlignment="Center"
  76. Data="{Binding Content,
  77. RelativeSource={RelativeSource TemplatedParent}}" >
  78. <Path.Fill>
  79. <SolidColorBrush Color="{DynamicResource GlyphColor}"/>
  80. </Path.Fill>
  81. </Path>
  82. </Border>
  83. </ControlTemplate>
  84. </Setter.Value>
  85. </Setter>
  86. </Style>
  87. <Style x:Key="ScrollBarPageButton"
  88. TargetType="{x:Type RepeatButton}">
  89. <Setter Property="SnapsToDevicePixels"
  90. Value="True" />
  91. <Setter Property="OverridesDefaultStyle"
  92. Value="true" />
  93. <Setter Property="IsTabStop"
  94. Value="false" />
  95. <Setter Property="Focusable"
  96. Value="false" />
  97. <Setter Property="Template">
  98. <Setter.Value>
  99. <ControlTemplate TargetType="{x:Type RepeatButton}">
  100. <Border Background="Transparent" />
  101. </ControlTemplate>
  102. </Setter.Value>
  103. </Setter>
  104. </Style>
  105. <Style x:Key="ScrollBarThumb"
  106. TargetType="{x:Type Thumb}">
  107. <Setter Property="SnapsToDevicePixels"
  108. Value="True" />
  109. <Setter Property="OverridesDefaultStyle"
  110. Value="true" />
  111. <Setter Property="IsTabStop"
  112. Value="false" />
  113. <Setter Property="Focusable"
  114. Value="false" />
  115. <Setter Property="Template">
  116. <Setter.Value>
  117. <ControlTemplate TargetType="{x:Type Thumb}">
  118. <Grid Background="#00FFFFFF" IsHitTestVisible="True" Margin="-10">
  119. <Border CornerRadius="3" Margin="10"
  120. Background="{StaticResource module-primary-color-brush}"
  121. BorderThickness="0" />
  122. </Grid>
  123. </ControlTemplate>
  124. </Setter.Value>
  125. </Setter>
  126. </Style>
  127. <ControlTemplate x:Key="VerticalScrollBar"
  128. TargetType="{x:Type ScrollBar}">
  129. <Grid Background="#00FF0000" Margin="0,5,0,5">
  130. <Grid.RowDefinitions>
  131. <RowDefinition Height="*" />
  132. </Grid.RowDefinitions>
  133. <Border Grid.RowSpan="3"
  134. CornerRadius="3"
  135. Background="#000000" />
  136. <Track x:Name="PART_Track"
  137. Grid.Row="1"
  138. IsDirectionReversed="true">
  139. <Track.DecreaseRepeatButton>
  140. <RepeatButton Style="{StaticResource ScrollBarPageButton}"
  141. Command="ScrollBar.PageUpCommand" />
  142. </Track.DecreaseRepeatButton>
  143. <Track.Thumb>
  144. <Thumb Style="{StaticResource ScrollBarThumb}">
  145. </Thumb>
  146. </Track.Thumb>
  147. <Track.IncreaseRepeatButton>
  148. <RepeatButton Style="{StaticResource ScrollBarPageButton}"
  149. Command="ScrollBar.PageDownCommand" />
  150. </Track.IncreaseRepeatButton>
  151. </Track>
  152. </Grid>
  153. </ControlTemplate>
  154. <ControlTemplate x:Key="HorizontalScrollBar"
  155. TargetType="{x:Type ScrollBar}">
  156. <Grid Background="#00FF0000" Margin="5,0,5,0">
  157. <Grid.ColumnDefinitions>
  158. <ColumnDefinition Width="*" />
  159. </Grid.ColumnDefinitions>
  160. <Border Grid.ColumnSpan="3"
  161. CornerRadius="3"
  162. Background="#F0F0F0" />
  163. <Track x:Name="PART_Track"
  164. Grid.Column="1"
  165. IsDirectionReversed="False">
  166. <Track.DecreaseRepeatButton>
  167. <RepeatButton Style="{StaticResource ScrollBarPageButton}"
  168. Command="ScrollBar.PageLeftCommand" />
  169. </Track.DecreaseRepeatButton>
  170. <Track.Thumb>
  171. <Thumb Style="{StaticResource ScrollBarThumb}">
  172. </Thumb>
  173. </Track.Thumb>
  174. <Track.IncreaseRepeatButton>
  175. <RepeatButton Style="{StaticResource ScrollBarPageButton}"
  176. Command="ScrollBar.PageRightCommand" />
  177. </Track.IncreaseRepeatButton>
  178. </Track>
  179. </Grid>
  180. </ControlTemplate>
  181. <Style x:Key="{x:Type ScrollBar}"
  182. TargetType="{x:Type ScrollBar}">
  183. <Setter Property="SnapsToDevicePixels"
  184. Value="True" />
  185. <Setter Property="OverridesDefaultStyle"
  186. Value="true" />
  187. <Style.Triggers>
  188. <Trigger Property="Orientation"
  189. Value="Horizontal">
  190. <Setter Property="Width"
  191. Value="Auto" />
  192. <Setter Property="Height"
  193. Value="6" />
  194. <Setter Property="Template"
  195. Value="{StaticResource HorizontalScrollBar}" />
  196. </Trigger>
  197. <Trigger Property="Orientation"
  198. Value="Vertical">
  199. <Setter Property="Width"
  200. Value="6" />
  201. <Setter Property="Height"
  202. Value="Auto" />
  203. <Setter Property="Template"
  204. Value="{StaticResource VerticalScrollBar}" />
  205. </Trigger>
  206. </Style.Triggers>
  207. </Style>
  208. </ResourceDictionary>