User (Old forums)MemberDecember 18, 2006 at 12:14 pmPost count: 23064
To Whom It May Concern:
I sent Xceed an email of the following, but I wanted to post here so others may reply or use the information at a later time. I will post any response I recieve via email…
My company is evaluating Xceed’s UI Library; unfortunately, we are having difficulty achieving the desired results when using your DockingWindows functionality. I have been becoming familiar with the control over the last few hours but have found a possible show-stopper for our purchase.
Background information: Developing in .net 2005, C#
I have successfully implemented a demo that allows me to Auto-hide ToolWindow objects within a DockLayoutManager when this is associated with a form. Unfortunately, this does not work when I want to associate a DockLayoutManager to a custom windows control.
Is there a way to associate a DockLayoutmanager to a Control instead of just a forms window?
Thanks for any quick advice 🙂
Imported from legacy forums. Posted by toedwy (had 6119 views)User (Old forums)MemberDecember 19, 2006 at 9:35 amPost count: 23064
It depends what you mean by “associate a DockLayoutManager to a custom control”.
If you want the region of your form that is used as the DockHost to be a user control which is present on the form, then you simply need to set the DockHost = myControl.
If you want the custom control to be the “owner” of the DockLayoutManager (DLM), and have the DLM to be apply to any form unto which the custom control is added, it should be feasible, but through code only.
In this case, the custom control would have to detect when it is added to a form or moved to another form (via the ParentChanged event or something alike), call FindForm() to get the form in question, and then, you would be able to initialize the DLM, and assign the form to the DockHost property.
Imported from legacy forums. Posted by André (had 436 views)User (Old forums)MemberDecember 19, 2006 at 9:53 amPost count: 23064
Andre, Thank you for your response,
I created a Windows Control Library Project. Below is the bare basics of the code of this control.
public partial class UserControl1 : UserControl
//declaring the layoutmanager
private DockLayoutManager _layoutManager;
this.Name = “Fred”;
_layoutManager = new DockLayoutManager( this, null );
_layoutManager.AllowDocking = false;
_layoutManager.AllowFloating = false;
_layoutManager.AllowHide = false;
_layoutManager.AllowAutoHide = true;
private void CreateBasicToolWindow()
//create some test controls
GroupBox gb = new GroupBox();
gb.Name = “gbTest”;
gb.Text = “TEST”;
CheckBox ocb = new CheckBox();
ocb.Name = “cbTest”;
ocb.Text = “Test CB: “;
ocb.Dock = DockStyle.Top;
//Add it to the groupbox
gb.Controls.Add( ocb );
//Create the toolwindow and add the control
ToolWindow oTW = new ToolWindow( gb, “PlotDetails” );
oTW.Name = “namecontrol”;
oTW.Text = “ToolBox”;
//Add the toolwindow obj to the layoutmanager
*****Errors here _layoutManager.ToolWindows.Add( oTW );
This code will not work….
When I attempt to add a Toolwindow object to the Layoutmanager, it gives me the following error.
Failed to create UserControl ‘controlTest.UserControl1’
The error message was ‘Value cannot be null. Parameter name: owner’
Imported from legacy forums. Posted by toedwy (had 588 views)User (Old forums)MemberDecember 19, 2006 at 9:56 amPost count: 23064
Continued from my above post:
Now, if I were to do the same exact code but on a form, it works fine….
The difference between the two: the UserControl uses the public partial class UserControl1 : UserControl versus a Form that uses public partial class Form1: Form.
Thanks for any response.
Imported from legacy forums. Posted by toedwy (had 885 views)User (Old forums)MemberJanuary 8, 2007 at 2:10 pmPost count: 23064
We have found a way to make this work. However, note that using the DLM in a UserControl is not a scenario that we support. That is, the DLM assumes it is in a form, and initializing it without such a form is not intended.
You need to set the state of the ToolWindow to Dock before adding it to the ToolWindows collection.
oTW.State = ToolWindowState.Docked;
//Then Add the toolwindow obj to the layoutmanager
_layoutManager.ToolWindows.Add( oTW );
The reason for this is that when the TW state is floating, the DLM looks for the main form, and does not find it. When set to Dock, it will not look for the main form.
This workaround is fine at form load, but any modification to the DLM / TW later in the application may not work. Basically, this is a scenario that we do not support, and you are using it “at your own risk”, if I may say.
Imported from legacy forums. Posted by André (had 414 views)User (Old forums)MemberJanuary 12, 2007 at 4:12 pmPost count: 23064
Thanks that made it work!!
I appreciate your time,
Imported from legacy forums. Posted by toedwy (had 610 views)User (Old forums)MemberJanuary 30, 2008 at 11:25 amPost count: 23064
We too are evaluating docking windows and require this behaviour. We are in fact adding a docking window to a tabbed Mdi child window and had exactly the same exception thrown.
The fix you give does work – thank you, but I am a little concerned (being in the evaluation stage!) by the “use at your own risk” bit. I understand that at the time of writing, the solution had probably not been fully tested etc. Are you likely to be in a position to “guarantee” the solution eventually?
Other suppliers do provide this functionality which require no special incantations but I suspect they do exactly what you recommend behind the scenes as it is apparenlty non-standard functionality – taking Visual Studio as the standard.
Imported from legacy forums. Posted by Nigel (had 447 views)
- You must be logged in to reply to this topic.