Files
Shrlalgo.RvKits/Melskin/Controls/GroupBox.xaml
2026-02-12 21:29:00 +08:00

50 lines
2.5 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type GroupBox}">
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
<Setter Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="Margin" Value="4" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Padding" Value="4" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupBox}">
<Grid SnapsToDevicePixels="true">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="32" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 边框与背景 -->
<Border
Grid.RowSpan="2"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4" />
<!-- 头部 -->
<Border
x:Name="Header"
Grid.Row="0"
Background="{TemplateBinding BorderBrush}"
CornerRadius="4,4,0,0">
<ContentPresenter
Margin="8"
ContentSource="Header"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
TextElement.Foreground="{DynamicResource TextPrimaryBrush}" />
</Border>
<!-- 内容 -->
<ContentPresenter
Grid.Row="1"
Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>