Best way to serialize active tab in each ToolWindowContainer

Docking/MDI for WPF Forum

Posted 10 years ago by Phil Devaney - Senior Software Engineer, Serck Controls Ltd
Version: 4.5.0486
Avatar
I am using DockSiteLayoutSerializer to save and restore the location of my tool windows into user.config, but when I restore the layout the first tab in each ToolWindowContainer is selected and I want the previously selected tab to be restored.

I have come up with some code to do this:

// In Window.Loaded handler, after call to DockSiteLayoutSerializer.LoadFromString
foreach ( var s in Properties.Settings.Default.SelectedTools.Split( ';' ) )
{
  var window = this.dockSite.GetDockingWindow( s );
  if ( window != null )
    window.IsSelected = true;
}

// In Window.Closing handler, after call to DockSiteLayoutSerializer.SaveToString
var selectedTools = from t in this.dockSite.ToolWindows
                    where t.IsSelected
                    select t.Name;
Properties.Settings.Default.SelectedTools = string.Join( ";", selectedTools.ToArray() );
Is this the best way to do this? Is IsSelected the best property to use to determine which ToolWindows are active? Could something be added to DockSiteLayoutSerializer to save this information?

PS Looks like your C# colorizer could do with updating for C# 3.0 :)

Comments (1)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Phil,

Good suggestion, we'll add this feature to the next maintenance release.


Actipro Software Support

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.