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

Docking Manager add new child

Hello,

I have been playing around with the docking manager a little bit, and was wondering if you had any tips for me. My goal is to dynamically add new windows to the docking manager via a drag and drop "toolbox" if you will. This would work very similar to the way the toolbox works in visual studio - drag items from the toolbox over to your docking manager.

There are two major hurdles that I see while implementing this, the first being how to trigger the DockingManager's "drag mode". Is there a way I can drag an item from my toolbox, and as I hover over the syncfusion DockingManager, bring up the dock arrows like you would normally see when dragging items around?

Second, it looks like it will be reasonably difficult to dynamically add items to the right location in my DockingManager. I've taken a peek at the way things seem to be layed out using this sort of syntax:
sftools:DockingManager.SideInDockedMode="Bottom"
but it seems like that might get complicated if I'm trying to programmatically add in new windows.

If anyone has any advice as to how I might accomplish my task, I would be very appreciative!

Thanks,

Shaun



8 Replies

BA Balavasanth Syncfusion Team November 5, 2008 08:42 PM UTC


Hi Shaun,

Thanks for your interests in Syncfusion products.

Displaying DragProvider through programatically is not possible since that is runtime behavior, so the users can drop the dragged item, and it will create as float window, then you can dock it any where in the client area using the mouse. Instead if you need dropped window as a Dock Window kindly make use of the code snippet.

//For dropped window as Dock Window
DockingManager.SetSideInDockedMode(dockPanel, DockSide.Right);
DockingManager.SetState(dockPanel, DockState.Dock);

It is very easy to dynamically add items to the right location in our Docking Manager. And our API's are very user friendly, For instance sftools:DockingManager.SideInDockedMode="Bottom" is the one you have mentioned in your update, which is a simple attached property. Kindly make use of the following code snippet to set the SetSideInDockedMode programmatically.

DockingManager.SetSideInDockedMode(depedencyobject,DockSide.Bottom);

It's very simple when you try to programmatically add new windows in DockingManager.

For your reference we are sending you a simple sample, where we have explained how Docking Manager are added dynamically and dropped window as a Float Window. Kindly download it from the below mentioned location.

http://www.syncfusion.com/support/user/uploads/DockingSampe123-813719387.zip

Please let us know if you have any queries.

Regards,
Bala.



MC Moon Chung February 26, 2009 08:39 PM UTC

I downloaded the sample for the drag & drop. But when I ran it, I noticed that that drag & drop from TreeViewAdv to DockingManager does not do anything. Is there anything that you have to do so that drop can actually happen?

Thanks.
Moon

>
Hi Shaun,

Thanks for your interests in Syncfusion products.

Displaying DragProvider through programatically is not possible since that is runtime behavior, so the users can drop the dragged item, and it will create as float window, then you can dock it any where in the client area using the mouse. Instead if you need dropped window as a Dock Window kindly make use of the code snippet.

//For dropped window as Dock Window
DockingManager.SetSideInDockedMode(dockPanel, DockSide.Right);
DockingManager.SetState(dockPanel, DockState.Dock);

It is very easy to dynamically add items to the right location in our Docking Manager. And our API's are very user friendly, For instance sftools:DockingManager.SideInDockedMode="Bottom" is the one you have mentioned in your update, which is a simple attached property. Kindly make use of the following code snippet to set the SetSideInDockedMode programmatically.

DockingManager.SetSideInDockedMode(depedencyobject,DockSide.Bottom);

It's very simple when you try to programmatically add new windows in DockingManager.

For your reference we are sending you a simple sample, where we have explained how Docking Manager are added dynamically and dropped window as a Float Window. Kindly download it from the below mentioned location.

http://www.syncfusion.com/support/user/uploads/DockingSampe123-813719387.zip

Please let us know if you have any queries.

Regards,
Bala.





BA Balavasanth Syncfusion Team March 2, 2009 06:19 PM UTC

Hi Moon,

Thanks for your interests in Syncfusion products.

We really thank you for diligently following up and bringing this defect to our attention. This has been considered as a breaking issue in our latest version with the Docking Manager. Our developers are working hard on to fixing this issue. The fix for this issue will be available along with our development build on 16th of March 2009. We deeply regret for this inconvenience caused.

Please let us know if you have any queries.

Regards,
Bala.



AD Administrator Syncfusion Team December 1, 2009 12:50 PM UTC

Bala,

I tried the link: http://www.syncfusion.com/support/user/uploads/DockingSampe123-813719387.zip

but got a browser error saying the page cannot be found.

I am also trying to add a new child programmatically, with a DockState of Document. However, when calling DockingManager.SetState, I get a StackOverflow exception. Here is the snippet:

Border myBorder = new Border();
TextBlock myText = new TextBlock();

myBorder.Child = myText;

myText.Text = "this doc just added";

dockingManager.Children.Add(myBorder);
DockingManager.SetDockingManager(myBorder, dockingManager);
DockingManager.SetHeader(myBorder, "header for new doc");
DocumentContainer.SetMDIBounds(myBorder, new Rect(30, 30, 300, 300));
DockingManager.SetState(myBorder, DockState.Document);

Any help or guidance is appreciated.

Chad


GS Githanjali S Syncfusion Team December 2, 2009 12:39 PM UTC

Hi Chad,

Please make sure that you are calling BeginInit and EndInit properly when you add children via code.

For example, below code should work perfectly.

public Window2()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(Window2_Loaded);
}

void Window2_Loaded(object sender, RoutedEventArgs e)
{
docking.BeginInit();
StackPanel panel = new StackPanel();
docking.Children.Add(panel);
DockingManager.SetState(panel, DockState.Document);
docking.EndInit();
}


Please let me know if you have any queries.

Regards,
Githanjali


AD Administrator Syncfusion Team December 2, 2009 02:22 PM UTC

Githanjali,

When I wrap adding the child with BeginInit & EndInit, I still get the same behavior: a stack overflow on the call to SetState.

If I remove the call to SetState, I do not get a stack overflow.

Chad


AD Administrator Syncfusion Team December 4, 2009 10:43 PM UTC

I think this is a bug. The version is: 7.3.0.20.

The issue occurs when your XAML has an object with SideInDockedMode="Bottom", and another XAML object with DockingManager.State="Document". Where the SideInDockedMode="Bottom" object is declared above the DockingManager.State="Document" within the XAML. And then you add a docuemnt object in code.

If you declare your document object above the bottom object, no stack overflow.

Attached is a project which recreates.

Chad



DynamicAddDockWindow_789c9ea3.zip


HK Hemanth Kumar K Syncfusion Team December 7, 2009 06:21 AM UTC

Hi Chad,

This issue is not reproducible in our latest version, Please install our latest version which is available from the link below.

http://www.syncfusion.com/downloads/latest-version

Unlock key:

If your Essential Studio license is current, you will be able to obtain the key to install this version from
your account in DirectTrac. Otherwise, please contact your Syncfusion Sales Representative or e-mail
salessupport@syncfusion.com.

Please let us know if you have any queries,

Thanks,
HemanthKumar K.

Loader.
Live Chat Icon For mobile
Up arrow icon