|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:bpa="clr-namespace:BPA.UIControl">
-
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/Resources/Default.xaml" />
- </ResourceDictionary.MergedDictionaries>
-
- <BorderGapMaskConverter x:Key="BorderGapMaskConverter" />
-
- <!-- 默认 -->
- <Style x:Key="RubyerGroupBox" TargetType="{x:Type GroupBox}">
- <Setter Property="Background" Value="{DynamicResource ContainerBackground}" />
- <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
- <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
- <Setter Property="BorderThickness" Value="{DynamicResource DefaultBorderThickness}" />
- <Setter Property="IsTabStop" Value="False" />
- <Setter Property="Padding" Value="5" />
- <Setter Property="SnapsToDevicePixels" Value="True" />
- <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllContainerCornerRadius}" />
- <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource DefaultForeground}" />
- <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}" />
- <Setter Property="bpa:HeaderHelper.FontWeight" Value="Normal" />
- <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Left" />
- <Setter Property="bpa:HeaderHelper.VerticalAlignment" Value="Top" />
- <Setter Property="bpa:HeaderHelper.Padding" Value="0 5" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type GroupBox}">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <ContentPresenter Margin="{Binding Path=(bpa:HeaderHelper.Padding), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- HorizontalAlignment="{Binding Path=(bpa:HeaderHelper.HorizontalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- VerticalAlignment="{Binding Path=(bpa:HeaderHelper.VerticalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- ContentSource="Header"
- RecognizesAccessKey="True"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
- TextBlock.FontFamily="{Binding Path=(bpa:HeaderHelper.FontFamily), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- TextBlock.FontSize="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- TextBlock.FontWeight="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- TextBlock.Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
- <Border x:Name="border"
- Grid.Row="1"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}">
- <ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Border>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!-- 经典 -->
- <Style x:Key="ClassicGroupBox" TargetType="{x:Type GroupBox}">
- <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
- <Setter Property="BorderThickness" Value="{DynamicResource DefaultBorderThickness}" />
- <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
- <Setter Property="IsTabStop" Value="False" />
- <Setter Property="Padding" Value="5" />
- <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource DefaultForeground}" />
- <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllContainerCornerRadius}" />
- <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}" />
- <Setter Property="bpa:HeaderHelper.FontWeight" Value="Normal" />
- <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Left" />
- <Setter Property="bpa:HeaderHelper.VerticalAlignment" Value="Top" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type GroupBox}">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="6" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="6" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- <RowDefinition Height="6" />
- </Grid.RowDefinitions>
- <Border Grid.Row="1"
- Grid.RowSpan="3"
- Grid.Column="0"
- Grid.ColumnSpan="4"
- Background="Transparent"
- BorderBrush="Transparent"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
- <Border Grid.Row="1"
- Grid.RowSpan="3"
- Grid.ColumnSpan="4"
- BorderBrush="Transparent"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}">
- <Border.OpacityMask>
- <MultiBinding Converter="{StaticResource BorderGapMaskConverter}" ConverterParameter="7">
- <Binding ElementName="Header" Path="ActualWidth" />
- <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
- <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
- </MultiBinding>
- </Border.OpacityMask>
- <Border BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
- </Border>
- <Border x:Name="Header"
- Grid.Row="0"
- Grid.RowSpan="2"
- Grid.Column="1"
- Padding="3 1 3 0">
- <ContentPresenter ContentSource="Header"
- RecognizesAccessKey="True"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
- TextBlock.FontFamily="{Binding Path=(bpa:HeaderHelper.FontFamily), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- TextBlock.FontSize="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- TextBlock.FontWeight="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- TextBlock.Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
- </Border>
- <ContentPresenter Grid.Row="2"
- Grid.Column="1"
- Grid.ColumnSpan="2"
- Margin="{TemplateBinding Padding}"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!-- 带颜色标题 -->
- <Style x:Key="ColorHeaderGroupBox" TargetType="{x:Type GroupBox}">
- <Setter Property="Background" Value="{DynamicResource ContainerBackground}" />
- <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
- <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
- <Setter Property="BorderThickness" Value="{DynamicResource DefaultBorderThickness}" />
- <Setter Property="IsTabStop" Value="False" />
- <Setter Property="Padding" Value="5" />
- <Setter Property="SnapsToDevicePixels" Value="True" />
- <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllContainerCornerRadius}" />
- <Setter Property="bpa:HeaderHelper.Background" Value="{DynamicResource Primary}" />
- <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource WhiteForeground}" />
- <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}" />
- <Setter Property="bpa:HeaderHelper.FontWeight" Value="Normal" />
- <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Left" />
- <Setter Property="bpa:HeaderHelper.VerticalAlignment" Value="Top" />
- <Setter Property="bpa:HeaderHelper.Padding" Value="5" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type GroupBox}">
- <Border x:Name="root"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <Border x:Name="header"
- Padding="{Binding Path=(bpa:HeaderHelper.Padding), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- Background="{Binding Path=(bpa:HeaderHelper.Background), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- BorderBrush="{TemplateBinding BorderBrush}"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
- <Border.CornerRadius>
- <MultiBinding Converter="{StaticResource TopInsideCornerRadiusConverter}">
- <MultiBinding.Bindings>
- <Binding ElementName="root" Path="BorderThickness" />
- <Binding ElementName="root" Path="CornerRadius" />
- </MultiBinding.Bindings>
- </MultiBinding>
- </Border.CornerRadius>
- <ContentPresenter HorizontalAlignment="{Binding Path=(bpa:HeaderHelper.HorizontalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- VerticalAlignment="{Binding Path=(bpa:HeaderHelper.VerticalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- ContentSource="Header"
- RecognizesAccessKey="True"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
- TextBlock.FontFamily="{Binding Path=(bpa:HeaderHelper.FontFamily), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- TextBlock.FontSize="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- TextBlock.FontWeight="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource Mode=TemplatedParent}}"
- TextBlock.Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
- </Border>
-
- <ContentPresenter Grid.Row="1"
- Margin="{TemplateBinding Padding}"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Grid>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
|