Search code examples
wpfmahapps.metrogroupbox

How to change my Group-box style


So this is my GroupBox:

<GroupBox 
    Header="My header"
    Background="Transparent"
    Foreground="Gainsboro"
    BorderBrush="Gainsboro" />

enter image description here

And i have several things that i want to change/issues:

  1. The Foreground is still in black although i have changed it.
  2. My boder around the Header: i want to remove it in order to achieve this kind of style (the header is over the border):

enter image description here

  1. All header is with upper case.

Edit:

After add the style that user @mm8 suggested, this is the results:

Why i can see duplicate border ?

enter image description here


Solution

  • Create your own set of controls to have full control, similar to this:

    <Grid Width="100" Height="200" Background="DodgerBlue">
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
    
        <Border BorderThickness="1" BorderBrush="Gainsboro">
            <TextBlock Foreground="Gainsboro">Header</TextBlock>
        </Border>
    
        <Border Grid.Row="1" BorderThickness="1" BorderBrush="Gainsboro">
            <!--Content-->
        </Border>
    </Grid>