Best way to serialize active tab in each ToolWindowContainer

Docking/MDI for WPF Forum

Posted 15 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 (3)

Posted 15 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

Posted 1 year ago by Bjørnar Sundsbø - Norway
Avatar

I notice this is a rather old post, but the original behavior described in it is still active. Selected tab in each container is not maintained when layout is activated. Any updates on how to address?

Saving within Tag is one option, as I see it. But considering the layout has information about selected tab, it would be awesome if that would be enable as well.


Bjørnar Sundsbø

Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

I tried to reproduce the selected tabs not being restored, but it seems to be working in my tests.  Please let us know how to reproduce it in one of our samples or email our support address with a new simple sample that shows it.  Be sure to exclude the bin/obj folders from any .zip you send so it doesn't get spam blocked, thanks.


Actipro Software Support

The latest build of this product (v24.1.1) 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.