closing the DockablePane

Jan 6, 2009 at 11:38 AM
Hi

I want to save the state (or position) of the dockable pane (floating, dockable or pinnable), when the DockablePane get closed.

So the next time when the DockablePane reappear it can be its previous state ( or postion).

Can anyone guide which event is fire when closing the DockablePane. So I can save the state (or postion) of the Dockable pane at time when closing event fire?

Thanks in Advance




Jan 12, 2009 at 6:57 PM
Hi, there are two built-in functions for this: DockManager.SaveLayout() and DockManager.RestoreLayout():

        private void SaveLayout_Click(object sender, RoutedEventArgs e)
        {
            string path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
                + @"\AvalonDockTest.Layout.xml";

            _dockingManager.SaveLayout(path);
        }

        private void RestoreLayout_Click(object sender, RoutedEventArgs e)
        {
            string path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
                + @"\AvalonDockTest.Layout.xml";
            if (!File.Exists(path))
                return;

            FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
            _dockingManager.RestoreLayout(fs);

            fs.Close();
        }

cheers,
Ado

Jan 15, 2009 at 3:37 AM
Edited Jan 15, 2009 at 3:38 AM
Thanks for your reply. :)

And also I want to save the layout when closing dockable panal.

Is there any event which get fired when the user click on the close button of dockable panel?

Thanks in Advance