import initial groupbox code
MODIFY
WalletWasabi.Gui/Controls/GroupBox.cs
WalletWasabi.Gui/Controls/GroupBox.cs
@@ -10,13 +10,8 @@ using System.Text;
namespace WalletWasabi.Gui.Controls
{
- public class GroupBox : ContentControl, IStyleable
+ public class GroupBox : ContentControl
{
- private ContentPresenter _titlePresenter;
- private Border _border;
-
- Type IStyleable.StyleKey => typeof(GroupBox);
-
public static readonly StyledProperty<object> TitleProperty =
AvaloniaProperty.Register<GroupBox, object>(nameof(Title));
@@ -25,24 +20,5 @@ namespace WalletWasabi.Gui.Controls
get => GetValue(TitleProperty);
set => SetValue(TitleProperty, value);
}
-
- protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
- {
- base.OnTemplateApplied(e);
-
- _titlePresenter = e.NameScope.Find<ContentPresenter>("PART_TitlePresenter");
-
- _border = e.NameScope.Find<Border>("PART_Border");
- }
-
- protected override Size ArrangeOverride(Size finalSize)
- {
- _border.Margin = new Thickness(0, -(_titlePresenter.DesiredSize.Height / 3), 0, 0);
- _border.Padding = new Thickness(0, (_titlePresenter.DesiredSize.Height / 3), 0, 0);
-
- _titlePresenter.Margin = new Thickness(Padding.Left, 0, 0, 0);
-
- return base.ArrangeOverride(finalSize);
- }
}
}

MODIFY
WalletWasabi.Gui/Controls/GroupBox.xaml
WalletWasabi.Gui/Controls/GroupBox.xaml
xmlns:local="clr-namespace:WalletWasabi.Gui.Controls;assembly=WalletWasabi.Gui">
<Style Selector="local|GroupBox">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Template">
<ControlTemplate>
- <DockPanel LastChildFill="True">
- <ContentPresenter
- Name="PART_TitlePresenter"
- DockPanel.Dock="Top"
- Background="{TemplateBinding Background}"
- Content="{TemplateBinding Title}"
- HorizontalAlignment="Left"
- ZIndex="1"
- Padding="10 0 10 0" />
- <Border Name="PART_Border" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource ThemeBorderLowBrush}">
- <ContentPresenter
- Name="PART_ContentPresenter"
- Background="{TemplateBinding Background}"
- ContentTemplate="{TemplateBinding ContentTemplate}"
- Content="{TemplateBinding Content}"
- Padding="{TemplateBinding Padding}"
- VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
- HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" />
+ <Grid UseLayoutRounding="True" ColumnDefinitions="6,Auto,*,6" RowDefinitions="Auto,Auto,*,6">
+ <Border CornerRadius="4" Grid.Row="1" Grid.RowSpan="3" Grid.Column="0" Grid.ColumnSpan="4" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="Transparent" Background="{TemplateBinding Background}" />
+ <Border CornerRadius="4" Grid.Row="1" Grid.RowSpan="3" Grid.ColumnSpan="4" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" />
+ <Border x:Name="Header" Padding="3,0,3,0" Grid.Row="0" Grid.RowSpan="2" Grid.Column="1">
+ <ContentPresenter Content="{TemplateBinding Title}" />
</Border>
- </DockPanel>
+ <ContentPresenter Content="{TemplateBinding Content}" />
+ </Grid>
</ControlTemplate>
</Setter>
</Style>

import initial groupbox code