Skip to main content

LayoutGroup.SelectTab(FrameworkElement) Method

Selects the specified child, displayed as a tab within the current LayoutGroup. This member is in effect when the current group is rendered as a tabbed group.

Namespace: DevExpress.Xpf.LayoutControl

Assembly: DevExpress.Xpf.LayoutControl.v24.1.dll

NuGet Package: DevExpress.Wpf.LayoutControl

Declaration

public bool SelectTab(
    FrameworkElement child
)

Parameters

Name Type Description
child FrameworkElement

A FrameworkElement object that specifies the group’s child to be selected

Returns

Type Description
Boolean

true if the specified item has been selected; otherwise, false.

Remarks

The SelectTab method is in effect when the group is represented as a tabbed group (the LayoutGroup.View property is LayoutGroupView.Tabs).

Use the LayoutGroup.SelectedTabChild property to get the selected child LayoutItem. The LayoutGroup.SelectedTabIndex property specifies an index of the selected tab.

The following code sample opens the tab2 LayoutGroup’s tab on a button click:

<Window ...
        xmlns:lc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol">
    <Grid x:Name="LayoutRoot" Background="White">
        <lc:LayoutControl Orientation="Vertical" Background="#FFEAEAEA" >
            <lc:LayoutGroup Orientation="Horizontal">
                <lc:LayoutGroup Orientation="Vertical">
                    <!-- ... -->
                </lc:LayoutGroup>
                <lc:LayoutGroup View="Tabs" x:Name="tabbedgroup">
                    <lc:LayoutGroup Header="Tab 1" Orientation="Vertical" x:Name="tab1">
                        <lc:LayoutItem Label="Item 5:">
                            <TextBox Width="100" />
                        </lc:LayoutItem>
                        <lc:LayoutItem Label="Item 6:" >
                            <TextBox/>
                        </lc:LayoutItem>
                        <lc:LayoutItem>
                            <Button Click="Button_Click" Content="Open Next Tab"/>
                        </lc:LayoutItem>
                    </lc:LayoutGroup>
                    <lc:LayoutGroup Header="Tab 2" x:Name="tab2">
                        <lc:LayoutItem Label="Item 7:">
                            <TextBox/>
                        </lc:LayoutItem>
                        <lc:LayoutItem Label="Item 8:">
                            <TextBox/>
                        </lc:LayoutItem>
                    </lc:LayoutGroup>
                </lc:LayoutGroup>
            </lc:LayoutGroup>
            <!-- ... -->
        </lc:LayoutControl>
    </Grid>
</Window>
private void Button_Click(object sender, RoutedEventArgs e) {
    tabbedgroup.SelectTab(tab2);
}
See Also