DXTabControl.GetTabItem(Int32) Method

Returns a tab item by its index.

Namespace: DevExpress.Xpf.Core

Assembly: DevExpress.Xpf.Core.v21.1.dll


public DXTabItem GetTabItem(
    int index


Name Type Description
index Int32

A zero-based integer value that specifies the tab item’s index.


Type Description

A DXTabItem object, that is a tab item with the specified index; null (Nothing in Visual Basic) if the specified index is out of range.


Use the GetTabItem method to obtain a tab item, when tab control’s data items are not the DXTabItem type. This happens when the tab control is bound to a data source, or when its Items collection has been manually filled with arbitrary objects. In this instance, the GetTabItem method returns a DXTabItem object, obtained from a data item with the specified index, using the template specified by the ItemTemplate property.

To obtain a tab item by a data item, use another overload of the GetTabItem method that takes the item parameter.


The following example shows how to allow end-users to only hide selected tab items.In this example, the SelectionChanged event is handled for this purpose. Tab items are obtained using the GetTabItem method.

View Example

<Window xmlns:controls="clr-namespace:DevExpress.Xpf.Core;assembly=DevExpress.Xpf.Core.v10.1"
        Title="MainWindow" Height="350" Width="525">
    <Grid x:Name="LayoutRoot" Loaded="LayoutRoot_Loaded">
        <controls:DXTabControl x:Name="tabControl" Height="150" Width="300"
                    <TextBlock Text="{Binding Path=ProductName}"/>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="ID = "/>
                            <TextBlock Text="{Binding Path=ID}" Foreground="Blue"/>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Price = "/>
                            <TextBlock Text="{Binding Path=Price}" Foreground="Blue"/>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Discount = "/>
                            <TextBlock Text="{Binding Path=Discount}" Foreground="Blue"/>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Order Date = "/>
                            <TextBlock Text="{Binding Path=OrderDate}" Foreground="Blue"/>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Status = "/>
                            <TextBlock Text="{Binding Path=Status}" Foreground="Blue"/>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Urgent = "/>
                            <TextBlock Text="{Binding Path=IsUrgent}" Foreground="Blue"/>
                <controls:TabControlScrollView AllowHideTabItems="False"/>
See Also