I’m confused on how to restore a docksite layout correctly. Here is what I’m currently doing:
1) Create workspace view model. This view model restores the documents and tool models. Here we will end up with a list of documents and a list of panels. They all have the correct ContentID from the last session.
2) Create window and set the data context. This window has the dock site. This dock site will bind to the documents and panels list from the view model.
3) Show the main window.
4) Restore the dock sites layout.
This is the only way I could get anything to work. It also has a side effect I don’t like because you see the window with the default layout and then it restores the layout from disk causing everything to shuffle around. This seems slow because it must destroy and recreate everything from scratch.
What I would like is to have everything loaded and bound before I call the show so the window comes up looking right.
I’ve tried to use lazy loading with no luck. Here how I went about it:
1) Create window.
2) Load layout on the dock site (I set the deserialization behavior to lazyload)
3) Create workspace view model. This view model restores the documents and tool models. Here we will end up with a list of documents and a list of panels. They all have the correct ContentID from the last session.
4) Set the data context to the workspace view model.
5) Show the window.
Now at step four I expected that when it binds to the view model it would look up into its lazy data and find an already created docking window and assign the new model. But what happens is I only see the default layout.
Let me know what I’m doing wrong please!