Loading from XML while RadDock is hidden

2 posts, 0 answers
  1. Luc
    Luc avatar
    4 posts
    Member since:
    Jul 2013

    Posted 21 Mar 2014 Link to this post

    Here is an interesting situation :

    - I use a RadDock containing 2 ToolWindows, docked in a shared TabStrip.
    - I change win1's dockstate to 'floating'.
    - I change win2's dockstate to 'autohide'.
    - I save RadDock's configuration in an XML file.
    - I use RadDock.Hide().

    Now, to avoid a possible flicker on the screen, I wish to load the previous XML file before showing RadDock again. After RadDock.Show(), both ToolWindows are in a 'autohide' state ! If I 'unpin' win1, it gets back to the 'floating' state. But double-clicking on its title-bar won't dock it any more.

    Is there a way to safely load a XML configuration while having RadDock hidden ?
  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 26 Mar 2014 Link to this post

    Hello Luc,

    Thank you for contacting Telerik Support.

    I confirm that it is an issue with our RadDock's saving/loading layout, when you have two ToolWindows, docked in a shared TabStrip (one of which is in "AutoHide" state and the other window is in "Floating" state). I have logged it in our Feedback Portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - Feedback Item.

    I have also updated your 
    Telerik points.

    Currently, the possible solution that I can suggest is to restore manually the correct state:
    Dictionary<string, DockState> currentState = new Dictionary<string, DockState>();
     
    public Form1()
    {
        InitializeComponent();
    }
    //load layout
    private void radButton2_Click(object sender, EventArgs e)
    {
         this.radDock1.LoadFromXml("..\\..\\..\\layout1.xml");
        foreach (DockWindow window in this.radDock1.DockWindows.ToolWindows)
        {
            if (currentState.ContainsKey(window.Text))
            {
                DockState state = currentState[window.Text];
                if (window.DockState != DockState.Docked)
                {
                    window.DockState = DockState.Docked;
                }
                window.DockState = state;
            }
        }
    }
     
    //save layout
    private void radButton1_Click(object sender, EventArgs e)
    {
         foreach (DockWindow window in this.radDock1.DockWindows.ToolWindows)
        {
            if (!currentState.ContainsKey(window.Text))
            {
                currentState.Add(window.Text, window.DockState);
            }
        }
        this.radDock1.SaveToXml("..\\..\\..\\layout1.xml");
    }

    I hope this information helps. Should you have further questions, I would be glad to help.
     
    Regards,
    Desislava
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top