DockSiteSerializer.LoadFromString does not apply IsActive set in my ViewModel

Docking/MDI for WPF Forum

Posted 5 years ago by Matthew Bristow
Version: 18.1.0674
Platform: .NET 4.7
Environment: Windows 10 (64-bit)

I've got a feeling this is going to be an easy one...

When using Layout Serialization with the Docksite it remembers the last active Document/Tool Window which I believe is through the LastActiveDateTime by default?

However it seems that this doesn't seem work to when I manually (well, programatically) set the IsActive property I bind my ToolWindows with to True.

Flow being I deserialize my settings file.

I create my ViewModels based of my Models. So for each of my Page models I create a PageViewModel, and then for each Display model within the Page model I create a DisplayViewModel. When I create these ViewModels I just pass in my model and assign the relevant properties ie this.IsOpen = model.IsOpen;  etc.

Then for my pageViewModels I add my these to my via DocumentItems.AddRange(newPages) which is bound to my DockSite.DocumentItems property. Then use the DockSiteSerializer.LoadFromString to apply my layout.

Now I would expect the IsActive setting of my DisplayViewModel to be applied but it isn't, but when I switch Pages it does apply the correct IsActive that would have been the last Display to have been Activated.

Looking at your MVVM examples I can see that you set IsOpen after you've added your ViewModels to your collection.

Is it the case that these settings need to be set after you've added your ViewModels to the collection?

Comments (3)

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Matthew,

While I don't believe IsOpen would need to be set before adding view models to the DockSite, it might be true that IsActive would need to be set afterwards since there can only be one of those at a time.  If you have a specific scenario you'd like us to look at, please send our support address a new simple sample project showing it and tell us what you expect to see and mention this thread.  We'll debug with that and get back to you.  Please remove the bin/obj folders in the ZIP and rename the .zip file extension so it doesn't get spam blocked.  Thanks!

Actipro Software Support

Posted 4 years ago by Doug Beck

Was there any resolution to this? We're having the same problem. 

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Doug,

I don't recall if we ever got an attachment from Matthew.  But the same answer would apply... if you have a scenario you'd like us to look at, please send us a sample per the instructions in the previous reply.  Thanks!

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.