Search code examples
wpfxamlmargingroupbox

How do I have a seperate padding for groupbox header and groupbox content


I have a groupbox, but I want to had a padding of 5 all around the header, but no margin around the content.

How would I best go about this? I can't seem to find a way to seperate the padding values from each other...


Solution

  • here a simple example

        <GroupBox Height="100" Width="200">
            <GroupBox.Header>
                <TextBlock Text="HEADER" Margin="10"></TextBlock>
            </GroupBox.Header>
            <Rectangle Fill="Blue"></Rectangle>
        </GroupBox>