This is a migrated thread and some comments may be shown as answers.

Dynamically load loadfromXML

3 Answers 155 Views
Dock
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 15 Jun 2010, 06:35 AM
I have serveral documents and tool windows opened on my maindoc,
I am using SaveLayout method to save my document, and tool windows position.

When i restart my application ifound that theres no way ican get which document or toolwindow are being loaded from .xml file.

I want to load each forms one by one and assign values to my static objects(this is necessary before loading each forms) of perticular document or toolwindow.

How can i accomplish this?
Which event will give me one by one loading of each window?

If thers other way then tell me.

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 22 Jun 2010, 03:56 PM
Hello James,

There is no dedicated event which is fired when a single window is loaded from xml. The event that is fired when you load a previously saved layout is LoadedFromXml and it is fired per loaded layout basis, but not per loaded DockWindow basis.

However, you can subscribe to the DockWindowAdded event. This event is fired when a DockWindow is added to RadDock, so when you load your layout, you will get the event fired for each DockWindow loaded by xml.

I hope this helps. If you need additional assistance on the topic, please provide me with additional details about your scenario. This will allow me to help you further.

Best wishes,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
James
Top achievements
Rank 1
answered on 25 Jun 2010, 11:54 AM

Thanks for the reply,

However, using this event also generating other problem, i am using Winform to add in RadDock
I am using below code line to add my WinForm in RadDock.

"AppGlobal.FrmAdminSettings" is my static object that contains the WinForm object to access all variables and data from that form.

MainDock.DockControl(

AppGlobal.FrmAdminSettings, DockPosition.Fill, DockType.Document );

Using Saving saves the Layout, on loading LoadFromXML an DockWindowAdded i am getting my form but Type is showing "HostWindow", this is creating problem in saving state of window in "AppGlobal.FrmAdminSettings" variable.

How can i save complete form state in my variable as it showing error cannot covert from HostWindow to Windows.Winform.

 

0
Nikolay
Telerik team
answered on 30 Jun 2010, 12:24 PM
Hello James,

When you save the layout of RadDock, the content of the DockWindows is not saved. There is information only about the DockWindow instances and their layout. That said, when the saved layout is loaded, your form is not automatically placed in the loaded HostWindows. You should perform this step in the DockWindowAdded event (considering that FrmAdminSettings is of type Form):
void radDock1_DockWindowAdded(object sender, Telerik.WinControls.UI.Docking.DockWindowEventArgs e)
{
    if (e.DockWindow.Name == "Form1")
    {
        ((HostWindow)e.DockWindow).LoadContent(AppGlobal.FrmAdminSettings);
    }
}

As to the state of the AppGlobal.FrmAdminSettings object, you can save its state by a serialization method of your choice. For example, you can save it as an xml file.

I hope this helps.

Greetings,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Dock
Asked by
James
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
James
Top achievements
Rank 1
Share this question
or