Document Tab Location

Is it possible to change the Tab location of the DocumentContainer in DockingManager?  Ideally I would like to move the tabs to the bottom.  If not, is there an alternative way to accomplish the same layout?  


7 Replies

SN Sudharsan Narayanan Syncfusion Team February 17, 2022 01:00 PM UTC

Hi Mitch,

You can be able to achieve the “Document tab location” requirement by using the TapStripPlacement property in the DocumentTabControl that will change the tab location. So, please find the code snippet from the below,

Code snippet:

(DG.DocContainer as DocumentContainer).Loaded += MainWindow_Loaded;
private void MainWindow_Loaded(object sender, RoutedEventArgs e) 
        { 
            DocumentTabControl tab = VisualUtils.FindDescendant(sender as Visual, typeof(DocumentTabControl)) as DocumentTabControl; 
            tab.TabStripPlacement = Dock.Bottom;             
        } 

Please check the above Code Snippet and let us know your concerns. We are happy to assist you.

Regards,
Sudharsan



MJ Mitch Janowski February 17, 2022 10:51 PM UTC

Hi Sudharsan,

Thank you for your help.  That worked perfectly.  The only thing is the label for the tab is now upside down.  How would I change the orientation of the tab header text?


Thank you again for your help.

Mitch



SN Sudharsan Narayanan Syncfusion Team February 18, 2022 04:35 PM UTC

Hi Mitch,

We were unable to reproduce the reported issue that "Tab header text is not aligned" from our end. So, please provide more details about the issue with reproducible samples and video for the same. And let us know if you have any customization in your application or any theme applied. It would be helpful for us to provide a solution quickly.

Regards,
Sudharsan



MJ Mitch Janowski February 28, 2022 08:04 PM UTC

Hi Sudharsan,

Sorry for the late response.  I've just got around to looking into the issue I was having.  I was able to solve the tab text orientation (thank you for your help).  


The problem I am having now is the tab location reverting back to the default location (top) once all the document tabs have been closed and I then add a new document tab.  Also, given the suggested approach, if there is not document in the DocumentTabControl when the TabStripPlacement property is set, no tab shows up at all.  Here is the code I am using.


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Navigation;

using System.Windows.Shapes;

using Syncfusion.Windows.Shared;

using Syncfusion.Windows.Tools.Controls;


namespace DockTabLocationExample

{

    /// <summary>

    /// Interaction logic for MainWindow.xaml

    /// </summary>

    public partial class MainWindow : Window

    {

        public MainWindow()

        {

            InitializeComponent();


        }

        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)

        {

            ContentControl cc = new ContentControl();

            DockingManager.SetDesiredWidthInDockedMode(cc, 150);

            DockingManager.SetHeader(cc, "Pane One");

            DockingManager.SetSideInDockedMode(cc, DockSide.Left);

            DockingManager.SetState(cc, DockState.Dock);

            Dock.Children.Add(cc);


// NewDocument_OnClick(this, new RoutedEventArgs());

        }

        private void Dock_OnLoaded(object sender, RoutedEventArgs e)

        {

            if (Dock.DocContainer is DocumentContainer dc)

            {

                dc.Loaded += DocumentContainer_Loaded;

                dc.Unloaded += DocumentContainer_UnLoaded;

                dc.Initialized += DcOnInitialized;

            }

        }

        private void DcOnInitialized(object? sender, EventArgs e)

        {


        }

        private void DocumentContainer_UnLoaded(object sender, RoutedEventArgs e)

        {


        }

        private void DocumentContainer_Loaded(object sender, RoutedEventArgs e)

        {

            if (VisualUtils.FindDescendant(sender as Visual, typeof(DocumentTabControl)) is DocumentTabControl tabControl)

            {

                tabControl.TabStripPlacement = System.Windows.Controls.Dock.Bottom;

            }

        }

        private void Dock_OnDockStateChanged(FrameworkElement sender, DockStateEventArgs e)

        {

            if (VisualUtils.FindDescendant(sender as Visual, typeof(DocumentTabControl)) is DocumentTabControl tabControl)

            {

                tabControl.TabStripPlacement = System.Windows.Controls.Dock.Bottom;

            }

        }

        private void Dock_OnDockWindowStateChanged(FrameworkElement sender, DockWindowStateEventArgs e)

        {


        }

        private void NewDocument_OnClick(object sender, RoutedEventArgs e)

        {

            ContentControl cc = new ContentControl();

            DockingManager.SetHeader(cc, $"Document {count++}");

            DockingManager.SetState(cc, DockState.Document);

            Dock.Children.Add(cc);


            if (VisualUtils.FindDescendant(Dock as Visual, typeof(DocumentTabControl)) is DocumentTabControl tabControl)

            {

                tabControl.TabStripPlacement = System.Windows.Controls.Dock.Bottom;

            }

        }


        private int count = 1;

    }

}






SN Sudharsan Narayanan Syncfusion Team March 2, 2022 03:18 AM UTC

Hi Mitch,

We can be able to reproduce the reported issue from our end and we have logged a bug report on this. The issue for this fix is available in patch on or before 22nd March 2022.
You can track the status of the issue using the feedback link below.   

Feedback: https://www.syncfusion.com/feedback/33095/layout-of-the-dockingmanager-is-wrong-when-tabstripplacement-is-bottom-and-adding


Regards,
Sudharsan
 



SN Sudharsan Narayanan Syncfusion Team March 23, 2022 04:03 AM UTC

Hi Mitch,

Currently, we are working with high priority for the reported issue. We will provide the fix for the issue in the patch version on 24th March 2022.
And please let us know your current version here.

Regards,
Sudharsan
 



SN Sudharsan Narayanan Syncfusion Team April 4, 2022 01:44 PM UTC

Hi Mitch,

Query 1: Add throw button click, there is not document in the DocumentTabControl when the TabStripPlacement property is set


Reported issue “Document Tab location” has been fixed, please download the patch from the below link.


Recommended approach - exe will perform automatic configuration.

Please find the patch setup from below location:

Patch link :

https://syncfusion.com/Installs/support/patch/19.4.0.48/958071/F172952/SyncfusionPatch_19.4.0.48_958071_4042022053942130_F172952.exe

Please find the patch assemblies alone from below location:

Assemblies Link:

https://syncfusion.com/Installs/support/patch/19.4.0.48/958071/F172952/SyncfusionPatch_19.4.0.48_958071_4042022053942130_F172952.zip

NuGet link:

https://syncfusion.com/Installs/support/patch/19.4.0.48/958071/F172952/SyncfusionNuget_19.4.0.48_958071_4042022053942130_F172952.zip


Assembly Version: 19.4.0.48

Installation Directions:

This patch should replace the files "Syncfusion.Tools.Wpf” under the following folder.

$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\[TargetFramework]

E.g. : $system drive:\Program Files\Syncfusion\Essential Studio\19.4.0.48\precompiledassemblies\19.4.0.48\4.6

To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you must manually copy and paste them to the preferred location, or you must run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.

https://www.syncfusion.com/support/directtrac/patches

Disclaimer:

Please note that we have created this patch for version 19.4.0.48 specifically to resolve the issue reported in this incident. If you have received other patches for the same version for other products, please apply all patches in the order received. Please let us know, if you are using any other Syncfusion version, we will provide patch in your version.

Note: This Issue will be included in your upcoming NuGet and Main Release.

Please let us know if you need any further assistance on this. We will be glad to assist you.

Query 2: I am having now is the tab location reverting to the default location (top) once all the document tabs have been closed and I then add a new document tab.

We suggest using the event by replacing from below code snippet, As If we close all the items means, the tabcontrolext will get disposed. New tabcontrolext will be created, if you add new document tab. For that your event won't call since it is hooked in DocumentContainer loaded. Please use the below one,

EventManager.RegisterClassHandler(typeof(DocumentTabControl), LoadedEvent, new RoutedEventHandler(DocumentTabControl_Loaded), true);

private void DocumentTabControl_Loaded(object sender, RoutedEventArgs e)
{
tabCon = sender as DocumentTabControl;
tabCon.TabStripPlacement = System.Windows.Controls.Dock.Bottom;
}


Please check the code snippet and let us know your concerns. We are happy to assist you.


Regards,
Sudharsan


Loader.
Up arrow icon