<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:MahApps.Metro.Controls">

    <Style x:Key="CleanGroupBoxStyleKey" TargetType="GroupBox">
        <Setter Property="BorderBrush" Value="{DynamicResource GrayBrush7}" />
        <Setter Property="BorderThickness" Value="0.3" />
        <Setter Property="Controls:ControlsHelper.HeaderFontSize" Value="16" />
        <Setter Property="Controls:GroupBoxHelper.HeaderForeground" Value="{DynamicResource TextBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GroupBox">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <Controls:ContentControlEx Grid.Row="0"
                                                   Margin="{TemplateBinding Padding}"
                                                   Content="{TemplateBinding Header}"
                                                   ContentCharacterCasing="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.ContentCharacterCasing)}"
                                                   ContentStringFormat="{TemplateBinding HeaderStringFormat}"
                                                   ContentTemplate="{TemplateBinding HeaderTemplate}"
                                                   ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                                                   FontSize="{TemplateBinding Controls:ControlsHelper.HeaderFontSize}"
                                                   FontStretch="{TemplateBinding Controls:ControlsHelper.HeaderFontStretch}"
                                                   FontWeight="{TemplateBinding Controls:ControlsHelper.HeaderFontWeight}"
                                                   Foreground="{TemplateBinding Controls:GroupBoxHelper.HeaderForeground}"
                                                   RecognizesAccessKey="True"
                                                   SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />

                        <Grid Grid.Row="1"
                              HorizontalAlignment="Stretch"
                              VerticalAlignment="Stretch">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.Resources>
                                <Style x:Key="InternalBorderStyle" TargetType="Border">
                                    <Setter Property="Panel.ZIndex" Value="1" />
                                    <Setter Property="VerticalAlignment" Value="Stretch" />
                                    <Setter Property="Width" Value="Auto" />
                                </Style>
                            </Grid.Resources>

                            <Border Grid.Column="0"
                                    Background="{TemplateBinding BorderBrush}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Style="{StaticResource InternalBorderStyle}" />

                            <ContentPresenter Grid.Column="1"
                                              Content="{TemplateBinding Content}"
                                              ContentTemplate="{TemplateBinding ContentTemplate}"
                                              Cursor="{TemplateBinding Cursor}" />

                            <Border Grid.Column="2"
                                    Background="{TemplateBinding BorderBrush}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Style="{StaticResource InternalBorderStyle}" />
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>