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.

171 lines
11 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. <ResourceDictionary.MergedDictionaries>
  5. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/Resources/Default.xaml" />
  6. </ResourceDictionary.MergedDictionaries>
  7. <Style x:Key="RubyerPageBarItem" TargetType="{x:Type bpa:PageBarItem}">
  8. <Setter Property="Background" Value="Transparent" />
  9. <Setter Property="Foreground" Value="{DynamicResource WhiteForeground}" />
  10. <Setter Property="MinWidth" Value="30" />
  11. <Setter Property="Focusable" Value="False" />
  12. <Setter Property="Padding" Value="{Binding ItemsPadding, RelativeSource={RelativeSource AncestorType=bpa:PageBar}}" />
  13. <Setter Property="Template">
  14. <Setter.Value>
  15. <ControlTemplate TargetType="{x:Type bpa:PageBarItem}">
  16. <Border Background="{TemplateBinding Background}"
  17. BorderBrush="{TemplateBinding BorderBrush}"
  18. BorderThickness="{TemplateBinding BorderThickness}">
  19. <Button x:Name="pageButton"
  20. MinWidth="{TemplateBinding MinWidth}"
  21. Margin="{TemplateBinding Padding}"
  22. Background="{Binding UnselectedBrush, RelativeSource={RelativeSource AncestorType=bpa:PageBar}}"
  23. Command="{Binding Command}"
  24. CommandParameter="{Binding Value}"
  25. Content="{Binding Content}"
  26. Foreground="{TemplateBinding Foreground}"
  27. IsEnabled="{Binding IsEnabled}"
  28. ToolTip="{Binding ToolTip}" />
  29. </Border>
  30. <ControlTemplate.Triggers>
  31. <DataTrigger Value="True">
  32. <DataTrigger.Binding>
  33. <MultiBinding Converter="{StaticResource IsEqualConverter}">
  34. <Binding Path="Value" />
  35. <Binding Path="PageIndex" RelativeSource="{RelativeSource AncestorType=bpa:PageBar}" />
  36. </MultiBinding>
  37. </DataTrigger.Binding>
  38. <Setter TargetName="pageButton" Property="Background" Value="{Binding SelectedBrush, RelativeSource={RelativeSource AncestorType=bpa:PageBar}}" />
  39. <Setter TargetName="pageButton" Property="Foreground" Value="{Binding SelectedForeground, RelativeSource={RelativeSource AncestorType=bpa:PageBar}}" />
  40. </DataTrigger>
  41. <DataTrigger Binding="{Binding IsRound, RelativeSource={RelativeSource AncestorType=bpa:PageBar}}" Value="True">
  42. <Setter TargetName="pageButton" Property="bpa:ButtonHelper.Shape" Value="Round" />
  43. </DataTrigger>
  44. </ControlTemplate.Triggers>
  45. </ControlTemplate>
  46. </Setter.Value>
  47. </Setter>
  48. </Style>
  49. <Style x:Key="TextPageBarItem" TargetType="{x:Type bpa:PageBarItem}">
  50. <Setter Property="Background" Value="Transparent" />
  51. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  52. <Setter Property="MinWidth" Value="30" />
  53. <Setter Property="Focusable" Value="False" />
  54. <Setter Property="Padding" Value="{Binding ItemsPadding, RelativeSource={RelativeSource AncestorType=bpa:PageBar}}" />
  55. <Setter Property="Template">
  56. <Setter.Value>
  57. <ControlTemplate TargetType="{x:Type bpa:PageBarItem}">
  58. <Border Background="{TemplateBinding Background}"
  59. BorderBrush="{TemplateBinding BorderBrush}"
  60. BorderThickness="{TemplateBinding BorderThickness}">
  61. <Button x:Name="pageButton"
  62. MinWidth="{TemplateBinding MinWidth}"
  63. Margin="{TemplateBinding Padding}"
  64. Background="Transparent"
  65. Command="{Binding Command}"
  66. CommandParameter="{Binding Value}"
  67. Content="{Binding Content}"
  68. FontSize="{TemplateBinding FontSize}"
  69. Foreground="{TemplateBinding Foreground}"
  70. IsEnabled="{Binding IsEnabled}"
  71. ToolTip="{Binding ToolTip}" />
  72. </Border>
  73. <ControlTemplate.Triggers>
  74. <DataTrigger Value="True">
  75. <DataTrigger.Binding>
  76. <MultiBinding Converter="{StaticResource IsEqualConverter}">
  77. <Binding Path="Value" />
  78. <Binding Path="PageIndex" RelativeSource="{RelativeSource AncestorType=bpa:PageBar}" />
  79. </MultiBinding>
  80. </DataTrigger.Binding>
  81. <Setter Property="Foreground" Value="{Binding SelectedBrush, RelativeSource={RelativeSource AncestorType=bpa:PageBar}}" />
  82. <Setter Property="FontWeight" Value="Bold" />
  83. </DataTrigger>
  84. <DataTrigger Binding="{Binding IsRound, RelativeSource={RelativeSource AncestorType=bpa:PageBar}}" Value="True">
  85. <Setter TargetName="pageButton" Property="bpa:ButtonHelper.Shape" Value="Round" />
  86. </DataTrigger>
  87. </ControlTemplate.Triggers>
  88. </ControlTemplate>
  89. </Setter.Value>
  90. </Setter>
  91. </Style>
  92. <Style x:Key="RubyerPageBar" TargetType="{x:Type bpa:PageBar}">
  93. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  94. <Setter Property="Background" Value="Transparent" />
  95. <Setter Property="UnselectedBrush" Value="{DynamicResource Primary}" />
  96. <Setter Property="SelectedBrush" Value="{DynamicResource Dark}" />
  97. <Setter Property="SelectedForeground" Value="{DynamicResource WhiteForeground}" />
  98. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  99. <Setter Property="IsTabStop" Value="False" />
  100. <Setter Property="ItemContainerStyle" Value="{StaticResource RubyerPageBarItem}" />
  101. <Setter Property="Padding" Value="0" />
  102. <Setter Property="SnapsToDevicePixels" Value="True" />
  103. <Setter Property="IsShowPageSize" Value="True" />
  104. <Setter Property="IsShowTotal" Value="True" />
  105. <Setter Property="ItemsDock" Value="Right" />
  106. <Setter Property="ItemsPadding" Value="3 0" />
  107. <Setter Property="ItemsPanel">
  108. <Setter.Value>
  109. <ItemsPanelTemplate>
  110. <WrapPanel Orientation="Horizontal" />
  111. </ItemsPanelTemplate>
  112. </Setter.Value>
  113. </Setter>
  114. <Setter Property="Template">
  115. <Setter.Value>
  116. <ControlTemplate TargetType="{x:Type bpa:PageBar}">
  117. <DockPanel Margin="{TemplateBinding Padding}" Background="{TemplateBinding Background}">
  118. <ItemsPresenter x:Name="items"
  119. Margin="5 0"
  120. DockPanel.Dock="{TemplateBinding ItemsDock}"
  121. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  122. <StackPanel x:Name="pageInfo"
  123. VerticalAlignment="Center"
  124. Orientation="Horizontal">
  125. <TextBlock VerticalAlignment="Center"
  126. Foreground="{TemplateBinding Foreground}"
  127. Text="{DynamicResource I18N_PageBar_Total}"
  128. Visibility="{TemplateBinding IsShowTotal, Converter={StaticResource BooleanToVisibleConverter}}" />
  129. <TextBlock Margin="5 0 0 0"
  130. VerticalAlignment="Center"
  131. FontWeight="Bold"
  132. Foreground="{TemplateBinding Foreground}"
  133. Text="{Binding Total, RelativeSource={RelativeSource AncestorType=bpa:PageBar}}"
  134. Visibility="{TemplateBinding IsShowTotal, Converter={StaticResource BooleanToVisibleConverter}}" />
  135. <TextBlock Margin="5 0 10 0"
  136. VerticalAlignment="Center"
  137. Foreground="{TemplateBinding Foreground}"
  138. Text="{DynamicResource I18N_PageBar_Piece}"
  139. Visibility="{TemplateBinding IsShowTotal, Converter={StaticResource BooleanToVisibleConverter}}" />
  140. <ComboBox MinWidth="90"
  141. VerticalAlignment="Center"
  142. bpa:ControlHelper.FocusBorderBrush="{TemplateBinding SelectedBrush}"
  143. bpa:ControlHelper.MouseOverBrush="{TemplateBinding SelectedBrush}"
  144. bpa:InputBoxHelper.IsRound="{TemplateBinding IsRound}"
  145. bpa:InputBoxHelper.PostContent="{DynamicResource I18N_PageBar_PageSize}"
  146. ItemsSource="{TemplateBinding PageSizeCollection}"
  147. SelectedItem="{Binding PageSize, RelativeSource={RelativeSource AncestorType=bpa:PageBar}}"
  148. Visibility="{TemplateBinding IsShowPageSize, Converter={StaticResource BooleanToVisibleConverter}}" />
  149. </StackPanel>
  150. </DockPanel>
  151. <ControlTemplate.Triggers>
  152. <Trigger Property="ItemsDock" Value="Left">
  153. <Setter TargetName="pageInfo" Property="HorizontalAlignment" Value="Right" />
  154. </Trigger>
  155. </ControlTemplate.Triggers>
  156. </ControlTemplate>
  157. </Setter.Value>
  158. </Setter>
  159. </Style>
  160. <Style x:Key="TextPageBar" TargetType="{x:Type bpa:PageBar}">
  161. <Setter Property="ItemContainerStyle" Value="{StaticResource TextPageBarItem}" />
  162. </Style>
  163. </ResourceDictionary>