DockSiteSerializer.LoadFromString does not apply IsActive set in my ViewModel

Docking/MDI for WPF Forum

The latest build of this product (v2018.1 build 0674) was released 2 months ago, which was before this thread was created.
Posted 1 month ago by Matthew Bristow
Version: 18.1.0674
Environment: Windows 10 (64-bit)
Avatar

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 (1)

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

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

Add Comment

Please log in to a validated account to post comments.