Dynamically load loadfromXML

4 posts, 0 answers
  1. James
    James avatar
    3 posts
    Member since:
    Jun 2010

    Posted 15 Jun 2010 Link to this post

    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.
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 22 Jun 2010 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. James
    James avatar
    3 posts
    Member since:
    Jun 2010

    Posted 25 Jun 2010 Link to this post

    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.

     

  5. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 30 Jun 2010 Link to this post

    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
Back to Top