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.

Hide (if needed) Tab Headers by unchecking ShowTabs option

Make TabControl visible according to selected RadioButton-value
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;
}
}
}
Last updated