using Avalon with MVVM

Jul 25, 2011 at 2:25 PM
Edited Jul 25, 2011 at 2:29 PM

Hi, I'm trying to use avalon with MVVM. I'm generating Document content tabs dynamically then adding them to an observable collection and binding that collection as a source to the DockingMananger's documentSouce.

DocumentContent tab = new DocumentContent() 
{
        Title = checkbox.Content.ToString(),
        Name = checkbox.Tag.ToString(),
        Tag = checkbox.Tag,
        Content = StockFuturesUserControl,
        IsCloseable = false,
        IsHitTestVisible = true,
        IsFloatingAllowed = true,
        DataContext = this
};
TradingItems.Add(tab);

<my:DockingManager Name="TradesDockmananger"
                   DocumentsSource="{Binding TradingItems}"
                   ActiveDocument="{Binding SelectedTradesTab}">
   <my:ResizingPanel Orientation="Horizontal">
        <my:DocumentPane/>
   </my:ResizingPanel>
</my:DockingManager>

Everything seems to work beautifully but i have one issue, I loose my binding when I detach my document contents from the parent Dockingmanager. To get over this, in my view model, i did this

This works well but the only problem i get is that I loose binding when I dock the documentContant to the bottom or top. I have no issue docking on the left and right.