We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to hide the header for the tabbed children in WPF DockingManager?

Platform: WPF |
Control: DockingManager |
Published Date: November 24, 2015 |
Last Revised Date: August 2, 2021 |
.NET Framework: 4.5

The dock header of the Tabbed children in the WPF DockingManager can be hidden by setting NoHeader property as True. Tabbed children can be fetching from the DockedElementTabbedHost in the DockingManager’s MouseUp event by checking its state is Dock state.

The same has been explained in the following code snippet:

XAML:

<Window x:Class="DockingManager.MainWindow"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
                 Title="MainWindow" Height="350" Width="525">
     <Grid>
          <syncfusion:DockingManager x:Name="DockingManager1" UseDocumentContainer="True" DockTabAlignment="Top"  >
              <ContentControl x:Name="content1" syncfusion:DockingManager.Header="Dock1" syncfusion:DockingManager.State="Dock"
> </ContentControl>
              <ContentControl x:Name="content2" syncfusion:DockingManager.Header="Dock2" syncfusion:DockingManager.State="Dock"></ContentControl>
              <ContentControl x:Name="content3" syncfusion:DockingManager.Header="Dock3" syncfusion:DockingManager.State="Dock"></ContentControl>
              <ContentControl x:Name="content4" syncfusion:DockingManager.Header="Dock4" syncfusion:DockingManager.State="Dock"></ContentControl>
           </syncfusion:DockingManager>
      </Grid>
</Window>

C#

using Syncfusion.Windows.Shared;
using Syncfusion.Windows.Tools.Controls;
 
namespace DockingManager
{
  /// <summary>
  /// Interaction logic for MainWindow.xaml
  /// </summary>
  public partial class MainWindow : Window
  {
    public MainWindow()
    {
      InitializeComponent();
      DockingManager1.MouseUp += DockingManager1_MouseUp;
    }
    private void DockingManager1_MouseUp(object sender, MouseButtonEventArgs e)
    {
      if (DockingManager1.ActiveWindow != null)
      {
        DockState state = DockingManager.GetState(DockingManager1.ActiveWindow);
        if (state == DockState.Dock)
        {
          DockedElementTabbedHost host = DockingManager.GetHost(DockingManager1.ActiveWindow, state);
          if (host != null)
          {
            host.TabChildren.CollectionChanged += TabChildren_CollectionChanged;
            if (host.TabChildren.Count > 1)
            {
              foreach (var child in host.TabChildren)
              {
                //Setting SetNoHeader property for the Tab children
                DockingManager.SetNoHeader(child as DependencyObject, true);
              }
            }
            else
            {
              foreach (var child in host.TabChildren)
              {
                DockingManager.SetNoHeader(child as DependencyObject, false);
              }
            }
          }
        }
      }
    }
    void TabChildren_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
    {
      if ((sender as ObservableCollection<FrameworkElement>).Count == 1)
      {
        DockingManager.SetNoHeader((sender as ObservableCollection<FrameworkElement>)[0],false);
      }
    }
  }
}

The following screenshot shows the dock header for the tabbed children get hidden in the DockingManager.

             WPF DockingManager displays dock header for tabbed children

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile