7 Answers, 1 is accepted
RadDock1.DockControl(new RadForm(), UI.Docking.DockPosition.Fill, UI.Docking.DockType.Document)
Indeed, you can dock a Form in RadDock by calling the DockControl method. However, this method will create a new instance of DockWindow.
In order to host a Form in an existing DockWindow (which actually should be a HostWindow) you should call the LoadContent method of the HostWindow:
((HostWindow)
this
.radDock1.DockWindows[0]).LoadContent(formInstance);
I hope this helps.
Kind regards,
Nikolay
the Telerik team
Hello Nikolay,
((HostWindow)
this
.radDock1.DockWindows[0]).LoadContent(formInstance);
Not work if radDock1.DockWindows[0]) is Telerik.WinControls.UI.Docking.ToolWindow.
error System.InvalidCastException
If you use the API suggested above, the LoadContent method will be available, because the DockControl method creates windows of type HostWindow. In case you want to load a Form in a ToolWindow, you should use the following API:
Form f =
new
Form();
f.Show();
f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
f.TopLevel =
false
;
f.Dock = DockStyle.Fill;
this
.radDock1.DockWindows[0].Controls.Add(f);
I hope this helps.
Kind regards,
Nikolay
the Telerik team
Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.
Hello Nikolay,
I use the LoadContent metod. The LoadContent metod create the ToolWindow.
1. I have an application with mdi forms.
2. If create the mdi form that dockcontrol create document(host window)
3. If this host window is make docked, and then floating, that after radDock1.SaveToXml radDock1.LoadFromXml radDock created the host window
4. !!! If this host window is make floating immediately, that after radDock1.SaveToXml radDock1.LoadFromXml radDock created the tool window
Therefore, there was a problem adding a form to an existing tool window.
Thanks for your help
Hello Nikolay,
Not work
f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
In regards to your last comment, the FormBorderStyle property is a property of the standard Microsoft Form object. Therefore, if your point concerns complication, this property should always allow you to compile your project. Please note the the 'f' variable of of type Form. If this is not you have meant by saying that FormBorderStyle property does not work, I would kindly ask you to provide us with additional details about your case. As a general recommendation, I would kindly ask you to be more descriptive when you are trying to explain an issue. An explanation that is short of details may be associated with a huge number of scenarios and we may not be aware of which one exactly is yours. Therefore, a complete description of a case will allow both sides to help each other and as a result your will get a quicker and more accurate response. Thank you for your cooperation and understanding.
As to the second to last message, I am not sure that I understand the meaning of the following sentence:
"I use the LoadContent metod. The LoadContent metod create the ToolWindow." The LoadContent method loads controls inside the content area of a HostWindow. This method can't create any type of a DockWindow, so I suppose that you mean the DockControl method.
Please note that in general, the DockControl method is not supposed to be used with MDI forms. The API that you should use in the MDI scenario is described here.
Let's say that you dock your forms thanks to the DockControl method instead of the MDI API. If I understand your case correctly, you first make one of the DockWindows float. Then you save the layout and try to load it afterwards. In this case all the created DockWindows should be of type HostWindows. I am attaching a sample project which demonstrates how this scenario works.
In case you need further assistance, please open a new support ticket and send us a sample project which demonstrates your scenario. In addition, describe the exact steps that we should follow in your project and the exact goal that you want to achieve. This will allow us to assist you further.
Nikolay
the Telerik team
Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.