GroupBox in WPF using VB.NET

In this article you will learn how to create a GroupBox in WPF.
  • 3547
A GroupBox is a class that derive from ContentControl that have only a single element in its body, so you have to use Panels to add childrens in its body. It allows to group content with a custom header in it and takes the text element which is placed as header of the GroupBox. In simpler words role of GroupBox is to represents a container that has both single-element content and a single-element header in form to displayed as a box with rounded corners and a title. GroupBox in WPF is same as it is in windows.

Example of GroupBox

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
    <GroupBox Header="Select Students" Padding="5"
Margin="5" VerticalAlignment="Top">
        <StackPanel Height="219">
            <RadioButton Margin="3">Amit</RadioButton>
            <RadioButton Margin="3">Riya</RadioButton>
            <RadioButton Margin="3">Manish</RadioButton>
            <RadioButton Margin="3">Rahul</RadioButton>
            <Button Margin="100">Ok</Button>
        </StackPanel>
    </GroupBox>
</
Window>

OUTPUT

 gb1.gif


CONCLUSION

Here you will see about GroupBox in WPF.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.