Completed
Last Updated: 16 Jan 2015 14:25 by ADMIN
ADMIN
Stefan
Created on: 12 Feb 2014 14:50
Category: Dock
Type: Bug Report
0
FIX. RadDock - Save/Load layout does not work as expected for HostWindows
To reproduce:
-add a RadDock with one ToolWindow;
-add two RadButtons;
Use the following code:


const string Filename = "dock.xml";


public Form1()
{
    InitializeComponent();


    var positions = (DockPosition[])Enum.GetValues(typeof(DockPosition));
    for (int i = 0; i < positions.Length; ++i)
    {
        RadButton btn = new RadButton();
        btn.Text = "Steps" + (i + 1);
        
        var position = positions[i];
        if (position == DockPosition.Fill)
        {
            radDock1.DockControl(btn, toolWindow1, position);
        }
        else
        {
            radDock1.DockControl(btn, position);
        }
    }
}


private void radButton1_Click(object sender, EventArgs e)
{
    using (var stream = File.Create(Filename))
    {
        radDock1.SaveToXml(stream);
    }
}


private void radButton2_Click(object sender, EventArgs e)
{
    if (File.Exists(Filename))
    {
        using (var stream = File.OpenRead(Filename))
        {
            radDock1.LoadFromXml(stream);
        }
    }
}


Steps to reproduce:
1.Float the Steps1 window
2.Hide the Steps1 floating window
3.File --> Save Layout
4.File --> Load Layout
5.Note that the Steps1 window is docked where it was before it was floated
6.Click the Steps1 toggle button in the RadCommandBar
7.Note that the Steps1 window is floating in the correct position


Workaround:
private void radMenuItem3_Click(object sender, EventArgs e)
{
    if (File.Exists(Filename))
    {
        using (var stream = File.OpenRead(Filename))
        {
            radDock1.LoadFromXml(stream);
            foreach (DockWindow window in this.radDock1.DockWindows.ToolWindows)
            {
                if (window.DockState == DockState.Hidden)
                {
                    window.DockState = DockState.Docked;
                    window.DockState = DockState.Hidden;
                }
            }
        }
    }
}
0 comments