Group Box

When we need to create the controls in the group then we use GroupBox Layout. The drawback of group box is that it can contain only one control, so we have to create another layout inside group box.

We can assign a Header to this group by using Header Property.

Example of Group Box

		
	<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Tech Altum" Height="500" Width="700">
    <GroupBox Header="Example of Group Box">
        <DockPanel>
        <Button DockPanel.Dock="Left" >Left Button</Button>
        <Button DockPanel.Dock="Bottom">Bottom Button</Button>
        <Button DockPanel.Dock="Right">Right Button</Button>
        <Button DockPanel.Dock="Top">Top Button</Button>
        <Button>Extra Space</Button>
    </DockPanel>
    </GroupBox>
</Window>

		
		

The output of this example as follows:-

Group box in WPF