TabItem in WPF using VB.NET

In this article you will learn how to create a TabItem in WPF.
  • 1924

TabItem is another class that derive from ContentControl which represents a page in a TabControl. The IsSelected property is the only significant member that the TabItem class adds indicates whether the tab is currently being shown in the TabControl.

The main area I wanted to change was the way in which the TabItems are arranged, currently the built-in TabControl will pack and stack items, so the more items there are, the more room is required for the headers, taking up space from the actual content of the TabItem.

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">
            <TabControl Margin="5">
            <TabItem>
                <TabItem.Header>
                    <StackPanel>
                        <TextBlock Margin="3" >Student's</TextBlock>
                    </StackPanel>
                </TabItem.Header>
                <StackPanel Margin="3">
                    <CheckBox Margin="3">Manish</CheckBox>
                    <CheckBox Margin="3">Rahul</CheckBox>
                    <CheckBox Margin="3">Ramesh</CheckBox>
                </StackPanel>
            </TabItem>
            <TabItem Header="Teacher's">
            <StackPanel Margin="3">
                <CheckBox Margin="3">Bhargav</CheckBox>
                <CheckBox Margin="3">Krishna</CheckBox>
                <CheckBox Margin="3">Jaeef</CheckBox>
            </StackPanel>
        </TabItem>
        </TabControl>
</
Window>

OUTPUT

tabitem.gif

CONCLUSION

Hope this article help you to understand about TabItem in WPF.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.