MuchinfoPagerStyle.xaml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:base="clr-namespace:Muchinfo.DataPager.Base;assembly=Client.DataPager"
  4. xmlns:dataPager="clr-namespace:Muchinfo.DataPager;assembly=Client.DataPager">
  5. <!-- <SolidColorBrush x:Key="MainBrush" Color="#00FFFFFF" /> -->
  6. <!--
  7. <SolidColorBrush x:Key="AccentBrush" Color="#FF25A0DA" />
  8. <SolidColorBrush x:Key="StrongBrush" Color="#FF767676" />
  9. -->
  10. <ControlTemplate x:Key="PageButtonTemplate" TargetType="{x:Type base:MuchinfoPagerNavigationButton}">
  11. <Grid SnapsToDevicePixels="True">
  12. <Border Name="Border"
  13. Background="{TemplateBinding Control.Background}"
  14. BorderBrush="{TemplateBinding Control.BorderBrush}"
  15. BorderThickness="{TemplateBinding Control.BorderThickness}"
  16. CornerRadius="11" />
  17. <Grid Name="ContentGrid">
  18. <ContentPresenter Name="Content"
  19. HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
  20. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  21. Content="{TemplateBinding ContentControl.Content}"
  22. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  23. Opacity="0.5">
  24. <ContentPresenter.RenderTransform>
  25. <TransformGroup>
  26. <ScaleTransform />
  27. <SkewTransform />
  28. <RotateTransform />
  29. <TranslateTransform />
  30. </TransformGroup>
  31. </ContentPresenter.RenderTransform>
  32. </ContentPresenter>
  33. </Grid>
  34. <Border Name="CommonStatesWrapper">
  35. <Border Name="FocusVisual"
  36. BorderBrush="{DynamicResource ButtonBackground}"
  37. BorderThickness="1"
  38. CornerRadius="11"
  39. Opacity="0"
  40. Visibility="Collapsed" />
  41. </Border>
  42. </Grid>
  43. <ControlTemplate.Triggers>
  44. <Trigger Property="UIElement.IsMouseOver" Value="True">
  45. <Setter TargetName="Border" Property="Border.Background" Value="{DynamicResource MouseOverBrush}" />
  46. <Setter TargetName="Content" Property="UIElement.Opacity" Value="1" />
  47. </Trigger>
  48. <Trigger Property="ButtonBase.IsPressed" Value="True">
  49. <Setter TargetName="Border" Property="Border.Background" Value="{DynamicResource MouseOverBrush}" />
  50. <Setter TargetName="Content" Property="UIElement.Opacity" Value="1" />
  51. <Setter TargetName="Content" Property="UIElement.RenderTransform">
  52. <Setter.Value>
  53. <TranslateTransform X="1" />
  54. </Setter.Value>
  55. </Setter>
  56. </Trigger>
  57. <Trigger Property="UIElement.IsEnabled" Value="False">
  58. <Setter TargetName="Content" Property="UIElement.Opacity" Value="0.3" />
  59. <Setter TargetName="Border" Property="UIElement.Opacity" Value="0.3" />
  60. </Trigger>
  61. <Trigger Property="UIElement.IsFocused" Value="True">
  62. <Setter TargetName="FocusVisual" Property="UIElement.Visibility" Value="Visible" />
  63. <Setter TargetName="FocusVisual" Property="UIElement.Opacity" Value="0.2" />
  64. </Trigger>
  65. </ControlTemplate.Triggers>
  66. </ControlTemplate>
  67. <Style x:Key="PageButtonStyle" TargetType="{x:Type base:MuchinfoPagerNavigationButton}">
  68. <Setter Property="Control.Template" Value="{StaticResource PageButtonTemplate}" />
  69. <Setter Property="Control.BorderBrush" Value="{DynamicResource MouseOverBrush}" />
  70. <Setter Property="Control.BorderThickness" Value="1" />
  71. <Setter Property="FrameworkElement.MinWidth" Value="22" />
  72. <Setter Property="FrameworkElement.MinHeight" Value="22" />
  73. <Setter Property="Control.HorizontalContentAlignment" Value="Center" />
  74. <Setter Property="Control.VerticalContentAlignment" Value="Center" />
  75. <Setter Property="FrameworkElement.Margin" Value="1,0" />
  76. </Style>
  77. <ControlTemplate x:Key="RadPageTemplate" TargetType="{x:Type base:MuchinfoPagerNumberRadioButton}">
  78. <Grid SnapsToDevicePixels="True">
  79. <Border Name="Border"
  80. Background="{TemplateBinding Control.Background}"
  81. BorderBrush="{TemplateBinding Control.BorderBrush}"
  82. BorderThickness="{TemplateBinding Control.BorderThickness}"
  83. CornerRadius="{TemplateBinding base:MuchinfoPagerNumberRadioButton.CornerRadius}" />
  84. <Border Name="CheckedVisual"
  85. Background="{DynamicResource MouseOverBrush}"
  86. BorderBrush="{TemplateBinding Control.BorderBrush}"
  87. BorderThickness="{TemplateBinding Control.BorderThickness}"
  88. CornerRadius="{TemplateBinding base:MuchinfoPagerNumberRadioButton.CornerRadius}"
  89. Opacity="0" />
  90. <Grid Name="ContentGrid">
  91. <ContentControl Name="Content"
  92. Margin="{TemplateBinding Control.Padding}"
  93. HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
  94. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  95. Content="{TemplateBinding ContentControl.Content}"
  96. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  97. Foreground="{TemplateBinding Control.Foreground}"
  98. IsTabStop="False">
  99. <ContentControl.RenderTransform>
  100. <TransformGroup>
  101. <ScaleTransform />
  102. <SkewTransform />
  103. <RotateTransform />
  104. <TranslateTransform />
  105. </TransformGroup>
  106. </ContentControl.RenderTransform>
  107. </ContentControl>
  108. </Grid>
  109. <Border Name="CommonStatesWrapper">
  110. <Border Name="FocusVisual"
  111. BorderBrush="{DynamicResource ButtonBackground}"
  112. BorderThickness="1"
  113. CornerRadius="{TemplateBinding base:MuchinfoPagerNumberRadioButton.CornerRadius}"
  114. Opacity="0"
  115. Visibility="Collapsed" />
  116. </Border>
  117. </Grid>
  118. <ControlTemplate.Triggers>
  119. <Trigger Property="ToggleButton.IsChecked" Value="True">
  120. <Setter TargetName="CheckedVisual" Property="UIElement.Opacity" Value="1" />
  121. <!-- <Setter TargetName="Content" Property="Control.Foreground" Value="{StaticResource MainBrush}" /> -->
  122. </Trigger>
  123. <MultiTrigger>
  124. <MultiTrigger.Conditions>
  125. <Condition Property="UIElement.IsEnabled" Value="False" />
  126. <Condition Property="ToggleButton.IsChecked" Value="True" />
  127. </MultiTrigger.Conditions>
  128. <Setter TargetName="CheckedVisual" Property="UIElement.Opacity" Value="0" />
  129. <Setter TargetName="Content" Property="UIElement.Opacity" Value="0.5" />
  130. </MultiTrigger>
  131. <Trigger Property="UIElement.IsMouseOver" Value="True">
  132. <Setter TargetName="Border" Property="Border.Background" Value="{DynamicResource MouseOverBrush}" />
  133. </Trigger>
  134. <Trigger Property="ButtonBase.IsPressed" Value="True">
  135. <Setter TargetName="CommonStatesWrapper" Property="UIElement.Opacity" Value="0" />
  136. <Setter TargetName="Border" Property="Border.Background" Value="{DynamicResource MouseOverBrush}" />
  137. <Setter TargetName="Content" Property="UIElement.RenderTransform">
  138. <Setter.Value>
  139. <TranslateTransform Y="1" />
  140. </Setter.Value>
  141. </Setter>
  142. </Trigger>
  143. <Trigger Property="UIElement.IsEnabled" Value="False">
  144. <Setter TargetName="Border" Property="UIElement.Opacity" Value="0.3" />
  145. <Setter TargetName="Content" Property="UIElement.Opacity" Value="0.3" />
  146. </Trigger>
  147. <Trigger Property="UIElement.IsFocused" Value="True">
  148. <Setter TargetName="FocusVisual" Property="UIElement.Visibility" Value="Visible" />
  149. <Setter TargetName="FocusVisual" Property="UIElement.Opacity" Value="0.2" />
  150. </Trigger>
  151. <MultiTrigger>
  152. <MultiTrigger.Conditions>
  153. <Condition Property="ToggleButton.IsChecked" Value="True" />
  154. <Condition Property="UIElement.IsMouseOver" Value="True" />
  155. <Condition Property="ButtonBase.IsPressed" Value="False" />
  156. </MultiTrigger.Conditions>
  157. <Setter TargetName="CheckedVisual" Property="Border.Background" Value="{DynamicResource MouseOverBrush}" />
  158. <!-- <Setter TargetName="Content" Property="Control.Foreground" Value="{StaticResource MainBrush}" /> -->
  159. </MultiTrigger>
  160. </ControlTemplate.Triggers>
  161. </ControlTemplate>
  162. <Style x:Key="RadPageStyle" TargetType="{x:Type base:MuchinfoPagerNumberRadioButton}">
  163. <Setter Property="Control.Template" Value="{StaticResource RadPageTemplate}" />
  164. <Setter Property="Control.Foreground" Value="{DynamicResource MainForegroundBrush}" />
  165. <Setter Property="Control.BorderBrush" Value="#00FFFFFF" />
  166. <Setter Property="Control.BorderThickness" Value="0" />
  167. <Setter Property="FrameworkElement.MinWidth" Value="22" />
  168. <Setter Property="FrameworkElement.MinHeight" Value="22" />
  169. <Setter Property="base:MuchinfoPagerNumberRadioButton.CornerRadius" Value="11" />
  170. <Setter Property="Control.HorizontalContentAlignment" Value="Center" />
  171. <Setter Property="Control.VerticalContentAlignment" Value="Center" />
  172. <Setter Property="Control.Padding" Value="6,0" />
  173. <Setter Property="FrameworkElement.Margin" Value="1,0" />
  174. </Style>
  175. <ControlTemplate x:Key="MuchinfoNumericElementsPresenterTemplate" TargetType="{x:Type base:MuchinfoNumericElementsPresenter}">
  176. <ItemsControl ItemsSource="{Binding Elements}">
  177. <ItemsControl.ItemsPanel>
  178. <ItemsPanelTemplate>
  179. <VirtualizingStackPanel Orientation="Horizontal" />
  180. </ItemsPanelTemplate>
  181. </ItemsControl.ItemsPanel>
  182. <ItemsControl.ItemTemplate>
  183. <DataTemplate>
  184. <base:MuchinfoPagerNumberRadioButton Command="{x:Static base:MuchinfoPagerCommands.MoveToPage}"
  185. CommandParameter="{Binding PageIndex}"
  186. Content="{Binding Content}"
  187. GroupName="{Binding GroupName}"
  188. IsChecked="{Binding IsCurrent,
  189. Mode=OneWay}"
  190. Style="{Binding NumericButtonStyle}" />
  191. </DataTemplate>
  192. </ItemsControl.ItemTemplate>
  193. </ItemsControl>
  194. </ControlTemplate>
  195. <Style TargetType="{x:Type base:MuchinfoNumericElementsPresenter}">
  196. <Setter Property="Control.Template" Value="{StaticResource MuchinfoNumericElementsPresenterTemplate}" />
  197. <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
  198. </Style>
  199. <ControlTemplate x:Key="MuchinfoDataPagerPresenterTemplate" TargetType="{x:Type base:MuchinfoPagerPresenter}">
  200. <Border Background="{TemplateBinding Control.Background}"
  201. BorderBrush="{TemplateBinding Control.BorderBrush}"
  202. BorderThickness="{TemplateBinding Control.BorderThickness}">
  203. <Grid HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}">
  204. <Grid.ColumnDefinitions>
  205. <ColumnDefinition Width="Auto" />
  206. <ColumnDefinition Width="Auto" />
  207. </Grid.ColumnDefinitions>
  208. <StackPanel Margin="2,0,0,0"
  209. HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
  210. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  211. Orientation="Horizontal">
  212. <base:MuchinfoPagerNavigationButton Name="MoveToFirstPageButton"
  213. Command="{x:Static base:MuchinfoPagerCommands.MoveToFirstPage}"
  214. RenderTransformOrigin="0.5,0.5"
  215. Style="{StaticResource PageButtonStyle}">
  216. <!--
  217. Visibility="{Binding PagerControlsVisibility.MoveToFirstPageControlVisibility,
  218. RelativeSource={RelativeSource TemplatedParent}}">
  219. -->
  220. <Path Width="12"
  221. Height="8"
  222. Data="M3.5,0.99999994L7,4 0,4z M0,0L7,0 7,0.99999994 3.5,0.99999994 0,0.99999994z"
  223. Fill="{DynamicResource ButtonBackground}"
  224. RenderTransformOrigin="0.5,0.5"
  225. Stretch="Fill">
  226. <Path.RenderTransform>
  227. <TransformGroup>
  228. <ScaleTransform />
  229. <SkewTransform />
  230. <RotateTransform Angle="90" />
  231. <TranslateTransform />
  232. </TransformGroup>
  233. </Path.RenderTransform>
  234. </Path>
  235. <base:MuchinfoPagerNavigationButton.RenderTransform>
  236. <TransformGroup>
  237. <ScaleTransform ScaleX="-1" />
  238. <SkewTransform />
  239. <RotateTransform />
  240. <TranslateTransform />
  241. </TransformGroup>
  242. </base:MuchinfoPagerNavigationButton.RenderTransform>
  243. </base:MuchinfoPagerNavigationButton>
  244. <base:MuchinfoPagerNavigationButton Name="MoveToPreviousPageButton"
  245. Command="{x:Static base:MuchinfoPagerCommands.MoveToPreviousPage}"
  246. RenderTransformOrigin="0.5,0.5"
  247. Style="{StaticResource PageButtonStyle}">
  248. <!--
  249. Visibility="{Binding PagerControlsVisibility.MoveToPreviousPageControlVisibility,
  250. RelativeSource={RelativeSource TemplatedParent}}"
  251. -->
  252. <Path Width="9"
  253. Height="12"
  254. Margin="2,0,0,0"
  255. Data="M0,0L9,6 0,12z"
  256. Fill="{DynamicResource ButtonBackground}"
  257. RenderTransformOrigin="0.5,0.5"
  258. Stretch="Fill" />
  259. <base:MuchinfoPagerNavigationButton.RenderTransform>
  260. <TransformGroup>
  261. <ScaleTransform ScaleX="-1" />
  262. <SkewTransform />
  263. <RotateTransform />
  264. <TranslateTransform />
  265. </TransformGroup>
  266. </base:MuchinfoPagerNavigationButton.RenderTransform>
  267. </base:MuchinfoPagerNavigationButton>
  268. <Border Height="22" VerticalAlignment="Center">
  269. <!--
  270. Visibility="{Binding PagerControlsVisibility.NumericElementsControlVisibility,
  271. RelativeSource={RelativeSource TemplatedParent}}">
  272. -->
  273. <base:MuchinfoNumericElementsPresenter NumericButtonCount="{TemplateBinding base:MuchinfoPagerPresenter.NumericButtonCount}"
  274. NumericButtonStyle="{TemplateBinding base:MuchinfoPagerPresenter.NumericButtonStyle}"
  275. PageCount="{TemplateBinding base:MuchinfoPagerPresenter.PageCount}"
  276. PageIndex="{TemplateBinding base:MuchinfoPagerPresenter.PageIndex}" />
  277. </Border>
  278. <base:MuchinfoPagerNavigationButton Name="MoveToNextPageButton"
  279. Command="{x:Static base:MuchinfoPagerCommands.MoveToNextPage}"
  280. Style="{StaticResource PageButtonStyle}">
  281. <!--
  282. Visibility="{Binding PagerControlsVisibility.MoveToNextPageControlVisibility,
  283. RelativeSource={RelativeSource TemplatedParent}}">
  284. -->
  285. <Path Width="9"
  286. Height="12"
  287. Margin="2,0,0,0"
  288. Data="M0,0L9,6 0,12z"
  289. Fill="{DynamicResource ButtonBackground}"
  290. RenderTransformOrigin="0.5,0.5"
  291. Stretch="Fill" />
  292. </base:MuchinfoPagerNavigationButton>
  293. <base:MuchinfoPagerNavigationButton Name="MoveToLastPageButton"
  294. Command="{x:Static base:MuchinfoPagerCommands.MoveToLastPage}"
  295. Style="{StaticResource PageButtonStyle}">
  296. <!--
  297. Visibility="{Binding PagerControlsVisibility.MoveToLastPageControlVisibility,
  298. RelativeSource={RelativeSource TemplatedParent}}">
  299. -->
  300. <Path Width="12"
  301. Height="8"
  302. Data="M3.5,0.99999994L7,4 0,4z M0,0L7,0 7,0.99999994 3.5,0.99999994 0,0.99999994z"
  303. Fill="{DynamicResource ButtonBackground}"
  304. RenderTransformOrigin="0.5,0.5"
  305. Stretch="Fill">
  306. <Path.RenderTransform>
  307. <TransformGroup>
  308. <ScaleTransform />
  309. <SkewTransform />
  310. <RotateTransform Angle="90" />
  311. <TranslateTransform />
  312. </TransformGroup>
  313. </Path.RenderTransform>
  314. </Path>
  315. </base:MuchinfoPagerNavigationButton>
  316. </StackPanel>
  317. <StackPanel Grid.Column="1"
  318. Margin="5,0"
  319. Orientation="Horizontal">
  320. <!--
  321. Visibility="{Binding PagerControlsVisibility.TextControlVisibility,
  322. RelativeSource={RelativeSource TemplatedParent}}">
  323. -->
  324. <!-- <TextBlock Margin="2,0" VerticalAlignment="Center" /> -->
  325. <base:MuchinfoPagerTextBox Height="20"
  326. MinWidth="30"
  327. MaxWidth="100"
  328. Margin="2,0"
  329. VerticalAlignment="Center"
  330. BorderThickness="1"
  331. Command="{x:Static base:MuchinfoPagerCommands.MoveToPage}"
  332. Style="{DynamicResource CommonTextBoxStyle}"
  333. PageIndex="{TemplateBinding base:MuchinfoPagerPresenter.PageIndex}" />
  334. <TextBlock Margin="2,0"
  335. VerticalAlignment="Center"
  336. Text="/" />
  337. <TextBlock Margin="2,0"
  338. VerticalAlignment="Center"
  339. Text="{Binding PageCount,
  340. RelativeSource={RelativeSource TemplatedParent}}" />
  341. </StackPanel>
  342. </Grid>
  343. </Border>
  344. </ControlTemplate>
  345. <Style TargetType="{x:Type base:MuchinfoPagerPresenter}">
  346. <Setter Property="Control.Template" Value="{StaticResource MuchinfoDataPagerPresenterTemplate}" />
  347. <Setter Property="SnapsToDevicePixels" Value="True" />
  348. </Style>
  349. <ControlTemplate x:Key="MuchinfoDataPagerTemplate" TargetType="{x:Type dataPager:MuchinfoPager}">
  350. <base:MuchinfoPagerPresenter HorizontalContentAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
  351. VerticalContentAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  352. Background="{TemplateBinding Control.Background}"
  353. BorderBrush="{TemplateBinding Control.BorderBrush}"
  354. BorderThickness="{TemplateBinding Control.BorderThickness}"
  355. ItemCount="{Binding ItemCount,
  356. RelativeSource={RelativeSource TemplatedParent},
  357. Mode=TwoWay}"
  358. NumericButtonCount="{TemplateBinding dataPager:MuchinfoPager.NumericButtonCount}"
  359. NumericButtonStyle="{TemplateBinding dataPager:MuchinfoPager.NumericButtonStyle}"
  360. PageCount="{TemplateBinding dataPager:MuchinfoPager.PageCount}"
  361. PageSize="{Binding PageSize,
  362. RelativeSource={RelativeSource TemplatedParent},
  363. Mode=TwoWay}"
  364. PageIndex="{TemplateBinding dataPager:MuchinfoPager.PageIndex}" />
  365. </ControlTemplate>
  366. <Style x:Key="PagerStyle" TargetType="{x:Type dataPager:MuchinfoPager}">
  367. <Setter Property="Control.Template" Value="{StaticResource MuchinfoDataPagerTemplate}" />
  368. <Setter Property="Background" Value="#00FFFFFF" />
  369. <Setter Property="Control.Foreground" Value="{DynamicResource MainForegroundBrush}" />
  370. <Setter Property="Control.BorderBrush" Value="#00FFFFFF" />
  371. <Setter Property="Control.BorderThickness" Value="0" />
  372. <Setter Property="dataPager:MuchinfoPager.NumericButtonStyle" Value="{StaticResource RadPageStyle}" />
  373. <Setter Property="FrameworkElement.Height" Value="30" />
  374. <Setter Property="Control.HorizontalContentAlignment" Value="Stretch" />
  375. <Setter Property="Control.VerticalContentAlignment" Value="Center" />
  376. <Setter Property="FontFamily" Value="Simsun, Microsoft YaHei" />
  377. <Setter Property="Control.FontSize" Value="12" />
  378. <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
  379. </Style>
  380. </ResourceDictionary>