csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
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.
90 lines
4.5 KiB
90 lines
4.5 KiB
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
x:ClassModifier="internal">
|
|
<Design.PreviewWith>
|
|
<GroupBox Padding="10" Margin="10">
|
|
<TextBlock Text="Hello World" />
|
|
</GroupBox>
|
|
</Design.PreviewWith>
|
|
|
|
<ControlTheme x:Key="{x:Type GroupBox}"
|
|
TargetType="GroupBox">
|
|
<Setter Property="BorderThickness" Value="{DynamicResource GroupBoxBorderThickness}" />
|
|
<Setter Property="Background" Value="{DynamicResource GroupBoxBackground}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource GroupBoxBorderBrush}" />
|
|
<Setter Property="Padding" Value="{DynamicResource GroupBoxPadding}" />
|
|
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate>
|
|
<Grid x:Name="RootGrid" UseLayoutRounding="true" ColumnDefinitions="6,Auto,*,6" RowDefinitions="Auto,Auto,*,6">
|
|
<!-- Separate Border for the background because if the background is set in the Border with the Header the opacity mask will be applied to the background as well. -->
|
|
<Border Grid.Row="1"
|
|
Grid.RowSpan="3"
|
|
Grid.Column="0"
|
|
Grid.ColumnSpan="4"
|
|
CornerRadius="{TemplateBinding CornerRadius}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
BorderBrush="Transparent"
|
|
Background="{TemplateBinding Background}"/>
|
|
|
|
<Border Grid.Row="1"
|
|
Grid.RowSpan="3"
|
|
Grid.ColumnSpan="4"
|
|
CornerRadius="{TemplateBinding CornerRadius}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
BorderBrush="{TemplateBinding BorderBrush}">
|
|
<Border.OpacityMask>
|
|
<VisualBrush>
|
|
<VisualBrush.Visual>
|
|
<Canvas Background="Transparent">
|
|
<Rectangle Fill="Transparent"
|
|
Width="{Binding #Header.Bounds.Width}"
|
|
Height="{Binding #Header.Bounds.Height}"
|
|
Canvas.Left="{Binding #Header.Bounds.X}"
|
|
Canvas.Top="{Binding #Header.Bounds.Y}"/>
|
|
</Canvas>
|
|
</VisualBrush.Visual>
|
|
</VisualBrush>
|
|
</Border.OpacityMask>
|
|
</Border>
|
|
|
|
<!-- ContentPresenter for the header -->
|
|
<Border x:Name="Header"
|
|
Padding="3,0,3,0"
|
|
Grid.Row="0"
|
|
Grid.RowSpan="2"
|
|
Grid.Column="1">
|
|
<ContentPresenter Name="PART_HeaderPresenter"
|
|
Content="{TemplateBinding Header}"
|
|
FontSize="{DynamicResource GroupBoxHeaderFontSize}"
|
|
Foreground="{DynamicResource GroupBoxHeaderForeground}"
|
|
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
UseLayoutRounding="{TemplateBinding UseLayoutRounding}" />
|
|
</Border>
|
|
<!-- Primary content for GroupBox -->
|
|
<ContentPresenter Grid.Row="2"
|
|
Grid.Column="1"
|
|
Grid.ColumnSpan="2"
|
|
Name="PART_ContentPresenter"
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
Content="{TemplateBinding Content}"
|
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
UseLayoutRounding="{TemplateBinding UseLayoutRounding}"
|
|
Margin="{TemplateBinding Padding}" />
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
|
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
|
<Setter Property="RecognizesAccessKey" Value="True" />
|
|
</Style>
|
|
|
|
<Style Selector="^ /template/ ContentPresenter#PART_HeaderPresenter">
|
|
<Setter Property="RecognizesAccessKey" Value="True" />
|
|
</Style>
|
|
|
|
</ControlTheme>
|
|
</ResourceDictionary>
|
|
|