Articles in this section
Category / Section

How to add a new button in the document state of DockingManager?

1 min read

In DockingManager, you can add a new button in the Document state by using the IsNewButtonEnabled property of the DocumentTabControl. To achieve this, you need to fetch the DocumentTabControl from the DockingManager and set the IsNewButtonEnabled property. Refer to the following code examples.


//The following code shows how the children of the DockingManager had added
<Window x:Class="WpfApplication24.MainWindow"
        Title="MainWindow" Height="350" Width="525">
        <syncfusion:DockingManager Name="Docking" UseDocumentContainer="True">
            <ContentControl syncfusion:DockingManager.Header="Document1" syncfusion:DockingManager.State="Document"/>
            <ContentControl syncfusion:DockingManager.Header="Document2" syncfusion:DockingManager.State="Document"/>
            <ContentControl syncfusion:DockingManager.Header="Document3" syncfusion:DockingManager.State="Document"/>


//The following code snippet explains how the IsNewButtonEnabled property is applied for the tabcontrol
using Syncfusion.Windows.Tools.Controls;
using Syncfusion.Windows.Shared;
namespace WpfApplication24
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
        public MainWindow()
            (Docking.DocContainer as DocumentContainer).Loaded += new RoutedEventHandler(MainWindow_Loaded);       
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
//This code represents the tabcontrol is fetched from the DockingManager            
DocumentTabControl tabcontrol = VisualUtils.FindDescendant(Docking.DocContainer as Visual, typeof(DocumentTabControl)) as DocumentTabControl;
            if (tabcontrol != null)
//This code shows how the NewButtonEnabled property is set for the tabcontrol           
                tabcontrol.IsNewButtonEnabled = true;
                tabcontrol.NewButtonClick += tabcontrol_NewButtonClick;              
        void tabcontrol_NewButtonClick(object sender, EventArgs e)
            MessageBox.Show("NewButton clicked");
        }   }    



The following screenshot displays how the New Button is added in the DockingManager.


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