[Version 2.0] How to bind a layoutanchorable to a single view model?

Jul 10, 2012 at 8:56 PM
Edited Jul 10, 2012 at 8:57 PM

Hi All,

I have been working pretty hard for the past week to try to migrate from 1.3 to 2.0.

I face two challenge right now, how to place a docking manager within a template for a document. (ie, each document has its own docking system within it). I was able to do this before, now it just blanks.


Second is the main purpose of this discussion. I have followed the example provided, and after long studying with it, i managed to understand and use it. However, I'm at a point where I have the main layoutpanel in the middle with my documents and some anchorable. And at the right and left side, i also have anchorables as well.

Now base on the example, i can bind using

DocumentsSource="{Binding documents}" and AnchorablesSource="{Binding anchorableViewModel}"

But since i have more then 1 anchorable pane, how do I bind my anchorable on the right and left side to
its own view model?

In other words, how do i bind viewmodels to anchorable without using the method above.


Jul 13, 2012 at 6:39 PM

You must provide a collection of all your ViewModels, (this can be a collection of object if you have different view models) to bind with AnchorablesSource and the to arrange them in the correct position of the layout you have to implement the ILayoutUpdateStrategy as shown in the AvalonDock.MVVMTestApp provided with the source code distribution.