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.

201 rivejä
14 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. <BorderGapMaskConverter x:Key="BorderGapMaskConverter" />
  8. <!-- 默认 -->
  9. <Style x:Key="RubyerGroupBox" TargetType="{x:Type GroupBox}">
  10. <Setter Property="Background" Value="{DynamicResource ContainerBackground}" />
  11. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  12. <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
  13. <Setter Property="BorderThickness" Value="{DynamicResource DefaultBorderThickness}" />
  14. <Setter Property="IsTabStop" Value="False" />
  15. <Setter Property="Padding" Value="5" />
  16. <Setter Property="SnapsToDevicePixels" Value="True" />
  17. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllContainerCornerRadius}" />
  18. <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource DefaultForeground}" />
  19. <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}" />
  20. <Setter Property="bpa:HeaderHelper.FontWeight" Value="Normal" />
  21. <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Left" />
  22. <Setter Property="bpa:HeaderHelper.VerticalAlignment" Value="Top" />
  23. <Setter Property="bpa:HeaderHelper.Padding" Value="0 5" />
  24. <Setter Property="Template">
  25. <Setter.Value>
  26. <ControlTemplate TargetType="{x:Type GroupBox}">
  27. <Grid>
  28. <Grid.RowDefinitions>
  29. <RowDefinition Height="Auto" />
  30. <RowDefinition Height="*" />
  31. </Grid.RowDefinitions>
  32. <ContentPresenter Margin="{Binding Path=(bpa:HeaderHelper.Padding), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  33. HorizontalAlignment="{Binding Path=(bpa:HeaderHelper.HorizontalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  34. VerticalAlignment="{Binding Path=(bpa:HeaderHelper.VerticalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  35. ContentSource="Header"
  36. RecognizesAccessKey="True"
  37. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  38. TextBlock.FontFamily="{Binding Path=(bpa:HeaderHelper.FontFamily), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  39. TextBlock.FontSize="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  40. TextBlock.FontWeight="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  41. TextBlock.Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  42. <Border x:Name="border"
  43. Grid.Row="1"
  44. Background="{TemplateBinding Background}"
  45. BorderBrush="{TemplateBinding BorderBrush}"
  46. BorderThickness="{TemplateBinding BorderThickness}"
  47. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}">
  48. <ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  49. </Border>
  50. </Grid>
  51. </ControlTemplate>
  52. </Setter.Value>
  53. </Setter>
  54. </Style>
  55. <!-- 经典 -->
  56. <Style x:Key="ClassicGroupBox" TargetType="{x:Type GroupBox}">
  57. <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
  58. <Setter Property="BorderThickness" Value="{DynamicResource DefaultBorderThickness}" />
  59. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  60. <Setter Property="IsTabStop" Value="False" />
  61. <Setter Property="Padding" Value="5" />
  62. <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource DefaultForeground}" />
  63. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllContainerCornerRadius}" />
  64. <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}" />
  65. <Setter Property="bpa:HeaderHelper.FontWeight" Value="Normal" />
  66. <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Left" />
  67. <Setter Property="bpa:HeaderHelper.VerticalAlignment" Value="Top" />
  68. <Setter Property="Template">
  69. <Setter.Value>
  70. <ControlTemplate TargetType="{x:Type GroupBox}">
  71. <Grid>
  72. <Grid.ColumnDefinitions>
  73. <ColumnDefinition Width="6" />
  74. <ColumnDefinition Width="Auto" />
  75. <ColumnDefinition Width="*" />
  76. <ColumnDefinition Width="6" />
  77. </Grid.ColumnDefinitions>
  78. <Grid.RowDefinitions>
  79. <RowDefinition Height="Auto" />
  80. <RowDefinition Height="Auto" />
  81. <RowDefinition Height="*" />
  82. <RowDefinition Height="6" />
  83. </Grid.RowDefinitions>
  84. <Border Grid.Row="1"
  85. Grid.RowSpan="3"
  86. Grid.Column="0"
  87. Grid.ColumnSpan="4"
  88. Background="Transparent"
  89. BorderBrush="Transparent"
  90. BorderThickness="{TemplateBinding BorderThickness}"
  91. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  92. <Border Grid.Row="1"
  93. Grid.RowSpan="3"
  94. Grid.ColumnSpan="4"
  95. BorderBrush="Transparent"
  96. BorderThickness="{TemplateBinding BorderThickness}"
  97. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}">
  98. <Border.OpacityMask>
  99. <MultiBinding Converter="{StaticResource BorderGapMaskConverter}" ConverterParameter="7">
  100. <Binding ElementName="Header" Path="ActualWidth" />
  101. <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
  102. <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
  103. </MultiBinding>
  104. </Border.OpacityMask>
  105. <Border BorderBrush="{TemplateBinding BorderBrush}"
  106. BorderThickness="{TemplateBinding BorderThickness}"
  107. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  108. </Border>
  109. <Border x:Name="Header"
  110. Grid.Row="0"
  111. Grid.RowSpan="2"
  112. Grid.Column="1"
  113. Padding="3 1 3 0">
  114. <ContentPresenter ContentSource="Header"
  115. RecognizesAccessKey="True"
  116. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  117. TextBlock.FontFamily="{Binding Path=(bpa:HeaderHelper.FontFamily), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  118. TextBlock.FontSize="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  119. TextBlock.FontWeight="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  120. TextBlock.Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  121. </Border>
  122. <ContentPresenter Grid.Row="2"
  123. Grid.Column="1"
  124. Grid.ColumnSpan="2"
  125. Margin="{TemplateBinding Padding}"
  126. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  127. </Grid>
  128. </ControlTemplate>
  129. </Setter.Value>
  130. </Setter>
  131. </Style>
  132. <!-- 带颜色标题 -->
  133. <Style x:Key="ColorHeaderGroupBox" TargetType="{x:Type GroupBox}">
  134. <Setter Property="Background" Value="{DynamicResource ContainerBackground}" />
  135. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  136. <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
  137. <Setter Property="BorderThickness" Value="{DynamicResource DefaultBorderThickness}" />
  138. <Setter Property="IsTabStop" Value="False" />
  139. <Setter Property="Padding" Value="5" />
  140. <Setter Property="SnapsToDevicePixels" Value="True" />
  141. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllContainerCornerRadius}" />
  142. <Setter Property="bpa:HeaderHelper.Background" Value="{DynamicResource Primary}" />
  143. <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource WhiteForeground}" />
  144. <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}" />
  145. <Setter Property="bpa:HeaderHelper.FontWeight" Value="Normal" />
  146. <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Left" />
  147. <Setter Property="bpa:HeaderHelper.VerticalAlignment" Value="Top" />
  148. <Setter Property="bpa:HeaderHelper.Padding" Value="5" />
  149. <Setter Property="Template">
  150. <Setter.Value>
  151. <ControlTemplate TargetType="{x:Type GroupBox}">
  152. <Border x:Name="root"
  153. Background="{TemplateBinding Background}"
  154. BorderBrush="{TemplateBinding BorderBrush}"
  155. BorderThickness="{TemplateBinding BorderThickness}"
  156. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  157. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  158. <Grid>
  159. <Grid.RowDefinitions>
  160. <RowDefinition Height="Auto" />
  161. <RowDefinition Height="*" />
  162. </Grid.RowDefinitions>
  163. <Border x:Name="header"
  164. Padding="{Binding Path=(bpa:HeaderHelper.Padding), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  165. Background="{Binding Path=(bpa:HeaderHelper.Background), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  166. BorderBrush="{TemplateBinding BorderBrush}"
  167. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  168. <Border.CornerRadius>
  169. <MultiBinding Converter="{StaticResource TopInsideCornerRadiusConverter}">
  170. <MultiBinding.Bindings>
  171. <Binding ElementName="root" Path="BorderThickness" />
  172. <Binding ElementName="root" Path="CornerRadius" />
  173. </MultiBinding.Bindings>
  174. </MultiBinding>
  175. </Border.CornerRadius>
  176. <ContentPresenter HorizontalAlignment="{Binding Path=(bpa:HeaderHelper.HorizontalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  177. VerticalAlignment="{Binding Path=(bpa:HeaderHelper.VerticalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  178. ContentSource="Header"
  179. RecognizesAccessKey="True"
  180. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  181. TextBlock.FontFamily="{Binding Path=(bpa:HeaderHelper.FontFamily), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  182. TextBlock.FontSize="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  183. TextBlock.FontWeight="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  184. TextBlock.Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  185. </Border>
  186. <ContentPresenter Grid.Row="1"
  187. Margin="{TemplateBinding Padding}"
  188. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  189. </Grid>
  190. </Border>
  191. </ControlTemplate>
  192. </Setter.Value>
  193. </Setter>
  194. </Style>
  195. </ResourceDictionary>