MVVM Docking Pattern that works with DockSite Layout Deserialization?

Docking/MDI for WPF Forum

Posted 10 years ago by Anargyros Tomaras
Version: 14.2.0610
Avatar

I am using MVVM with a ViewModel-first approach to handling Docking i.e i use ToolItemsSource.

That worked well until i had to restore a persisted DockSite Layout.

DockSite Layout deserialization is View-first which breaks my pattern that relies on 

an ObservableCollection<DockWindowViewModel>. For example how do i end up restoring

this VM collection along with the DockSite layout?

I am having a hard time firguring out a good pattern.

 

Any ideas? 

Comments (2)

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

Hi Anargyros,

The layout deserialization just cares that it is able to locate tool windows within the DockSite of a certain name and reposition them.  If you are working with MVVM, then you might also want to somehow persist your view model data out to some storage mechanism so that you can restore it into the DockSite prior to deserializing the layout file.  That way all the VMs would be available in the DockSite already as the layout is getting restored.


Actipro Software Support

Posted 10 years ago by Anargyros Tomaras
Avatar

Thanx for your answer!

Saving the VM state is a must as you correctly point out.
The way you propose i'd have to intercept the deserialization process and start wiring things up
i.e locate DockVMs and add them in the Observable<DockVM> collection.

My current approach is a little different. I apply the layout lazily to the DockSite and then
i attempt to rehydrate my DockVMs and databound ToolItemsSource collection.

[Modified 10 years ago]

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

Add Comment

Please log in to a validated account to post comments.