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.
Unfortunately, activation email could not send to your email. Please try again.

DockingManager

Thread ID:

Created:

Updated:

Platform:

Replies:

93553 Mar 19,2010 08:26 AM Sep 3,2010 07:33 AM Windows Forms 23
loading
Tags: Tools
Matt Speller
Asked On March 19, 2010 08:26 AM

Hey guys

I am writing some code that extracts properties from the Docking Manager based on the position of the controls on the screen.

I can dock two controls - one to the top and one to bottom and then look at the DockStyle of the two controls - one correctly states Top and the other states Bottom. Perfect. I can then get the Size of the control and persist the height for those with a docking style of Top or Bottom. And persist the width for those docked Left or Right. Perfect again.

The problem I have surrounds when I dock the first control to the top - and then dock the second within the first to the right. So that they are both docked to the top and appear one to the right and one to the left. (see below)

__________
|____|____|
| |
| |
| |

when I enquire for the docking style (GetDockingStyle(ctrl)), both return TOP. I assume that I need to work the path of the created dock panels and enquire the docking state of the panels rather than the controls. If I SaveDockingLayout() to xml, I see the docking styles are set to Right and Fill, as I would expect. Question is - how do I extract that information for myself by interacting with the docking manager??


Regards

Matt Speller

Rajasekar B [Syncfusion]
Replied On March 22, 2010 09:39 AM

Hi Matt,

Thank you for your interest in syncfusion product.

To get the docking style of a control and to which control does it docked, you can use DragDockInfo property.

Below is the sample code:

if (this.dockingManager1.GetDockVisibility(this.panel1))
{
DockHost dhc = this.panel1.Parent as DockHost;
String str= dhc.DragDockInfo.dStyle.ToString();
}

dStyle returns the style.

Please let me know if you have any question.

Thanks,
Rajasekar



DockingMgr_bfd3827e.zip

Administrator [Syncfusion]
Replied On March 22, 2010 12:24 PM

If its any use I needed the same thing for a different reason, check the thread here:

http://www.syncfusion.com/support/forums/tools-windows/92476/auto-balance-dockingmanager-windows

and you can see I needed to work out where a control was docked to regardless of it being tabbed-docked with another control. The code finds the tabbed panel set and extracts the panels style(position) not the actual controls style(position).

Matt Speller
Replied On March 22, 2010 12:55 PM

Thanks guys, will check it out and feed back.

Matt

Rajasekar B [Syncfusion]
Replied On March 25, 2010 07:53 AM

Hi Matt,

Thanks for the update.

Thanks,
Rajasekar

Matt Speller
Replied On March 25, 2010 10:56 AM

Hey Rajasekar,

Your post is exactly what I am after. That is the docking style I would like to persist. One other bit of information I require is to capture within what control it is docked.

For example if I add A and then dock B to the right within A, the dockstyle (using your helpful code) returns Right. Excellent! But how do I tell that it is docked within A? By examining the DragDockInfo I cannot tell this information.

When I try to recreate the docking at a later date, knowing A is docked top and B is docked right will not give me the same layout as docking B to the right inside of A.

Any further pointers would be great.

Matt

Rajasekar B [Syncfusion]
Replied On March 26, 2010 09:40 AM

Hi Matt,

You can use the following code

DockHost dhc = this.treeView1.Parent as DockHost;
dhc.DragDockInfo.dController.HostControl.Controls[0].

It will return the control to which treeview is docked.

Please let me know if you have any question.

Thanks,
Rajasekar



DockingMgr_877623aa.zip

Administrator [Syncfusion]
Replied On March 29, 2010 11:07 AM

In case you have not seen it, there is a built in method to load/save a layout, something like this:

http://www.syncfusion.com/support/kb/1395/How-do-I-persist-dockstate-in-a-DataBase

Matt Speller
Replied On March 31, 2010 05:34 AM

Many thanks Rajasekar,

having played with the code, I think I have found a couple of bugs. In a set of circumstances the DockHost does not report the correct docking style for the controls. Maybe there is a call to the DockingManager to refresh the state that I am missing.

Please look at your modified project you will find attached. Using the method you suggested earlier on this post, I cast the Parent of the docked control to the DockHost and then query the DragDockInfo.dStyle to attain the docking style. This works perfectly in most cases.

In the modified soultion I have added another message box when the user presses the 'Treeview Docked To' menu button that reports the treeview1 dock style.

If you follow the set of circumstances below, the one or both message boxes report the wrong information:

Issue 1.
Press 'Treeview Docked To' - correctly reports dock parent as main form, but suggests DockStyle is left - in fact it is TOP.

Issue 2.
dock treeview2 to right of main form.
dock treeview1 to bottom of treeview 2.
Press 'Treeview Docked To' - correctly reports dock parent as treeview2 and style as Bottom.
dock treeview2 to bottom of main form.
Press 'Treeview Docked To' - incorrectly reports dock parent as treeview2 and style as Bottom. It should now be docked to main form and dock style of right.

Please can you suggest the method I should use to solve this issue.

Matt




DockingMgr_fe8bf02f.zip

Vallarasu S [Syncfusion]
Replied On April 7, 2010 06:16 AM

Hi Matt,

Regret for the delay. We are analyzing this behavior in DockingManager and will update you the details in a week.

Regards
Vallarasu s.

Matt Speller
Replied On April 12, 2010 08:36 AM

Many thanks - awaiting confirmation of the fault and a suggested workaround / patch.

Vallarasu S [Syncfusion]
Replied On April 13, 2010 05:26 AM

Hi Matt,

Thanks for the patience.

You can get the dockstyle and the control to which another control has been docked to, using the below code,

DockHost dh = checkedListBox1.Parent as DockHost;
DockHostController dhc = dh.InternalController as DockHostController;
DockTabController dtc = dhc.ParentController as DockTabController;
MessageBox.Show("Dock Style : " + dhc.DICurrent.dStyle.ToString());
if (dtc != null)
{
MessageBox.Show("Tabbed in :" + dtc.TabControl.Name.ToString() + " with :" +dtc.HostControl.Controls[0].Name);
}
MessageBox.Show("Docked To :" + dhc.DICurrent.dController.HostControl.Name);
if (dh.DragDockInfo.dController is DockHostController)
MessageBox.Show("At the :" + dh.DragDockInfo.dStyle.ToString()+ " side of "+ dh.DragDockInfo.dController.HostControl.Controls[0].Name);


Please refer the sample in below link which demonstrates the above.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=DockingmanagerDockinfo369487030.zip

Please let me know if it helps.

Regards
Vallarasu S.

Matt Speller
Replied On April 15, 2010 06:03 AM

Hi

The code you suggest does not resolve the issues I mentioned in incident.

If I dock the checkedlistbox to the right of the month calendar, then press Get Dock Info Check List button, I get three message boxes. 1. "Dock style Left" no - it is set to right 2. "Docked to form 1" no - it is docked to the month calendar. 3. To the right side of monthcalendar1. Yes! So that looked ok.

Then I moved the month calendar to be docked at the bottom after docking the checkedlistbox1 to the right of the calendar first. The 3 message box still reports it is docked to the right side of the monthCalendar1. This is incorrect.

Please read my initial posting that explained the issues clearly. Your attached soultion did not solve the issues.

See attached screen shots.

Matt



DockManager Incorrect Dock Style Reporting_721a8a88.zip

Rajasekar B [Syncfusion]
Replied On April 22, 2010 03:03 PM

Hi Matt,

Thanks for your patience,

We have worked around it in a sample to get the Docking style and the control to which it is docked. Please let us know if this helps you.

Thanks,
Rajasekar



DickingInfo_2d6092f4.zip

Matt Speller
Replied On April 27, 2010 08:18 AM

Marvellous - I will look at the code and see it if is satisfactory.

Lingaraj S [Syncfusion]
Replied On April 29, 2010 11:44 PM

Hi Matt,

Thank you for your update and participation in Syncfusion’s Community Forums.

Please let me know if you have any queries.

Regards,
Lingaraj S.

Matt Speller
Replied On May 11, 2010 10:41 AM

Hi guys,

I am afraid there is still an issue. It's rather more serious than before, as the dockingmanager/host ends up saying that two controls are parents of each other.

It has taken me a while to chase down the steps to recreate, please find the attached word document that shows the screens step by step.

I assume there will be more code around line 73 of the code supplied or further code in the DockStateChanging method to refresh the dock parent.

Please advise asap as to the estimated time to provide a work around. Please recreate with code example attached to your last reply to me.

Regards

Matt Speller



dockleftthenright_a571bb0e.zip

Lingaraj S [Syncfusion]
Replied On May 12, 2010 02:06 PM

Hi Matt,

Thank you for the update.

We are able to see the issue mentioned issue in Docking Manger. We working on this and will update you the solution ASAP.

Regards,
Lingaraj S.

Matt Speller
Replied On May 18, 2010 11:20 AM

Any update please?

Lingaraj S [Syncfusion]
Replied On May 18, 2010 03:03 PM

Hi Matt,

Thank you for the update.

I have modified the sample logic to retrieve the DockStyle and DockedControl of control.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=DockingInfo-2093360639.zip

Please have look at the above modified sample and let me know if you face any issues.

Regards,
Lingaraj S.

Matt Speller
Replied On August 24, 2010 11:38 AM

Hi there,

Having used the workarounds discussed in this thread for the last couple of months, they seem to account for 90% of the usage. There is a scenario that does cause the Docking Information to report incorrectly still. Please use the attachment from your last post to me.

Please follow the steps in the attached word doc. The first set show it working properly and the second set show how setting the controls to be tabbed before repeating the same actions cause the dock info to become confused.

Please advise how to change your code in the previous forum post, to cover this scenario.

Regards

Matt Speller




Load up test app_f2f6f13c.zip

Lingaraj S [Syncfusion]
Replied On August 25, 2010 09:50 AM

Hi Matt,

Thank you for the update.

Please try use DINew in GetStyle method to solve this issue.

private void GetStyle(Control con)
{
// other codes
else
{
MessageBox.Show("Dock Style : " + dhc.DINew.dStyle.ToString());
if (dhc.DINew.dController.HostControl != null)
{
MessageBox.Show("Docked At :" + dhc.DINew.dController.HostControl.Name);
}
else
{
MessageBox.Show("Docked At :" + dhc.DICurrent.dController.HostControl.Name);
}
}
}


Refer the sample from following link.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=DockingInfo_8_25-397086899.zip

Please let me know if you have any queries.

Regards,
Lingaraj S.

Matt Speller
Replied On August 27, 2010 10:05 AM

Thanks for the update. Unfortunately the code does not deal with the attached scenario.

Please advise how best to use your code to get the correct dock parent in all cases. The code you supplied does give the correct dock style. Parent is incorrect though.

From my tests I see that the DockHost is not always a DockHostController, it can be a MainFormController or a DockTabController. I think this if statement in your logic flow is where it fails. The DockHost USED to be a DockTabController and when moved, it is infact a DockHostController but the DockHost property still states it is a DockTabController - hence it returns the wrong parent.

Matt



issue_9b12e3fa.zip

Lingaraj S [Syncfusion]
Replied On September 3, 2010 07:33 AM

Hi Matt,

Regret for the delayed response.

You have created DirectTrac incident for this query. Please followup your queries with incident (#71738).

Please let me know if you have any other concerns.

Regards,
Lingaraj S.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.

;