> For the complete documentation index, see [llms.txt](https://tldocs.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tldocs.gitbook.io/documentation/development/framework/controls/tabcontrol.md).

# TabControl

xDockTab is used as the root/parent of the main module and anytime a tabItem may be docked.

xTabControl is more lightweight. It can be used with the option “ShowTabs” on false to overlay panels.

Both controls trigger the same events: TabChanging, tabChanged, have selectedIndex, selectedItem etc.

The following example shows how to display a certain control (in this case DataGrid), depending on the value of a RadioButton.

* Add TabControl on the Grid
* Add one TabItem for each control (DataGrid) that wants to be displayed.

![](https://2522353545-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXf5GuikRIHooatf_sm%2Fuploads%2Fgit-blob-4524172f89ce28e397cad11002d5998fe026aec4%2FTabControl_1.png?alt=media)

* Hide (if needed) Tab Headers by unchecking ShowTabs option

![](https://2522353545-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXf5GuikRIHooatf_sm%2Fuploads%2Fgit-blob-9a3e5b7b64d941499db649b3f13b6a724ddecacd%2FTabControl_2.png?alt=media)

* Make TabControl visible according to selected RadioButton-value

```csharp
public override void ItemChanged(UIElement container, FrameworkElement element, object selectedItem, object newValue, object oldValue)
{
    base.ItemChanged(container, element, selectedItem, newValue, oldValue);

    //Rows can be added to the grid -> Save before change tab
    if (element == rbgBezogen)
    {
        switch (rbgBezogen.Value.ToInt())
        {
            case 10:
                BusObj.Save();
                tabControl.SelectedItem = tabArt;
                break;
            case 20:
                BusObj.Save();
                tabControl.SelectedItem = tabGP;
                break;
        }
    }
}
```
