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

How to programatically add a collection of ContentControl as tabbed group in a new floating window on DockingManager?

I have a collection of ContentControls which I want to show them together as a tabbed group.

And this tabbed group should appear in a floating window.

How to do it programmatically?

I have tried using dockingManager.CreateHorizontalTabGroup and dockingManager.AddElementToTabGroup, but the tabbed group is spawn within the main document window.

I want them to be floated in one newly created floating window.

I have also tried adding a ContentConrtol (Name="Conrol1") with attached property setting it FloatState (DockingManager.SetState(controlToBeAdded1, DockState.Float)) to be floatted then add it to dockingManager (PART_DockingManager.Children.Add(controlToBeAdded1)), and then set the second ContentControl's attached property TargetNameInFloatingMode to be the name of the first ContentCtrol (DockingManager.SetTargetNameInFloatingMode(controlToBeAdded2, "Control1")) then add this secondControl into dockingManager (PART_DockingManager.Children.Add(controlToBeAdded2)).

This manages to add the second ContentControl to the newly spawn floating window of the first ContentContro, but the two controls are presented splitted-ly in the floating window without any tab, and they cannot be dragged and dropped into docking manager.

I am using UseNativeFloatWindow="True" and default the ContainerMode="TDI" by the way.

Edit: This is quite critical for my desktop app so it would be much appreciated if someone in the syncfusion team could address that they are noticing or even solving my problem. Well appreciated in advance.

Best regards


5 Replies 1 reply marked as answer

HN Harinath Navaneethakrishnan Syncfusion Team December 14, 2022 03:20 PM UTC

Hi King Cheong,


Sorry for the delay in getting back to you.

It is by design that a DockingManager has only one DocumentContainer which can be split horizontally or vertically. This document container as a whole cannot be floated, but individual tabs can be floated but it cannot act like a DocumentContainer.

You can create multiple DockingManager and swap children with each other using LinkedDockingManager. However, a linked docking manager will work when both are independent elements, but does not work when they are nested.

Please check and let us know if this is helpful to resolve your requirement.


Regards,

Harinath N



KC KING CHEONG FUNG December 14, 2022 04:43 PM UTC

Hi Harinath,


Thanks for your reply.

I am using DockingManager in WPF but not Winforms.

And if I do it manually, i.e. if I drag and drop a tabbed window in the main window to an existing floating window, it does do exactly what I want, i.e. the dropped window becomes a tabbed window inside the floating window.

I uploaded a gif showing what I mean. As you could see the left window is the main window with a DocumentContainer.

The right one is a floating window (UseNativeFloatWindow="True").

I can add "Control2" to the floating window as tabbed window by drag and drop.

I don't know if there is a DocumentContainer in the floating window or not though, as you said there is only one DocumentContainer in DockingManager.

But certainly it is a tabbed group in the floating window.

This is what I want, a collection of ContentControls added as tabbed group in a floating window.


I doubt if it can only be done with drag and drop. If this is the case then it is strange that we can do something by user dragging and dropping while it can't be done programmatically.

I noticed that for DockingManager WPF there is a LinkedManager feature too. But then the problem will be everytime I add a ContentCotrol to new a floating window, I need to wrap it with a new DockingManager.

I don't think this is the approach behind the seen when I do it by drag and drop.


Hope you understand my question.


Regards


Attachment: Recording_20221215_at_00.28.47.gif_a0e75dfd.zip



HN Harinath Navaneethakrishnan Syncfusion Team December 15, 2022 04:18 PM UTC

Hi King cheong,


Your requirement can be achieved by setting the tabbed for the SideInFloatMode attached property. We have created the sample based on your requirement. Please refer to the sample for your reference.

CodeSnippets:

DockingManager.SetState(content2, DockState.Float);
DockingManager.SetSideInFloatMode(content2, DockSide.Tabbed);
DockingManager.SetTargetNameInFloatingMode(content2, "content1");


Regards,

Harinath N


Attachment: DockingManager_(4)_(1)_6716236.zip

Marked as answer

KC KING CHEONG FUNG replied to Harinath Navaneethakrishnan December 15, 2022 04:59 PM UTC

Hi Harinath,


Thank you very much. It works in exactly what I want.

What I missed is using SetSideInFloatMode.

I appreciate the help from you and your team a lot.


Best regards.



GT Gokul Thanudhas Syncfusion Team December 16, 2022 04:12 PM UTC

We are glad to know that your issue has been fixed. Please let us know if you need any other assistance. We are happy to assist you.


Loader.
Up arrow icon