Articles in this section
Category / Section

How to disable tab groups in WPF DockingManager?

1 min read

To restrict creating a new tab group in TDI document, the TabGroupEnabled property of the WPF DockingManager need to set to False, so that drag and drop functionality of tab will restrict and New Horizontal Tab Group and New Vertical Tab group menu items will be hidden in the context menu of the TDI document.

The same has been explained in the following code example:

XAML:

<Grid x:Name="Grid1">
    <syncfusion:DockingManager x:Name="DockingManager1" UseDocumentContainer="True" TabGroupEnabled="False"  >
        <ContentControl x:Name="content1" syncfusion:DockingManager.Header="Document1" syncfusion:DockingManager.State="Document"/>
        <ContentControl x:Name="content2" syncfusion:DockingManager.Header="Document2" syncfusion:DockingManager.State="Document"/>
         <ContentControl x:Name="content3" syncfusion:DockingManager.Header="Document3" syncfusion:DockingManager.State="Document"/>
         <ContentControl x:Name="content4" syncfusion:DockingManager.Header="Document4" syncfusion:DockingManager.State="Document"/>
     </syncfusion:DockingManager>
</Grid>
</Window>

C#

namespace DockingManager
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DockingManager dockingmanager = new DockingManager();
            ContentControl content1 = new ContentControl();
            dockingmanager.UseDocumentContainer = true;
            DockingManager.SetHeader(content1, "Document1");
            DockingManager.SetState(content1, DockState.Document);
            ContentControl content2 = new ContentControl();
            DockingManager.SetHeader(content2, "Document2");
            DockingManager.SetState(content2, DockState.Document);
            ContentControl content3 = new ContentControl();
            DockingManager.SetHeader(content3, "Document3");
            DockingManager.SetState(content3, DockState.Document);
            ContentControl content4 = new ContentControl();
            DockingManager.SetHeader(content4, "Document4");
            DockingManager.SetState(content4, DockState.Document);
        //Disable the TabGroupEnabled by setting its false, so the tabgroup will be hidden.
            dockingmanager.TabGroupEnabled = false;
            dockingmanager.Children.Add(content1);
            dockingmanager.Children.Add(content2);
            dockingmanager.Children.Add(content3);
            dockingmanager.Children.Add(content4);
            Grid1.Children.Add(dockingmanager);    
        }
    }
}

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied