This project is read-only.

ActiveDocument always null

Jan 10, 2011 at 1:47 PM

I'm using MVVM and bind the ActiveDocument to a DocumentContent property in the ViewModel. I did this under version 1.2 and it worked fine. Whatever I try in 1.3 the property I'm binding the ActiveDocument to remains null, while in debugging I can see that the dockingmanager.activedocument is set correctly.

Does anyone have an idea about the mistake I'm making?


        <avalon:DockingManager x:Name="dockingManagerMain" Loaded="DockingManager_Loaded" DocumentsSource="{Binding Path=DocumentContents}" ActiveDocument="{Binding Path=SelectedTab}">
            <avalon:ResizingPanel x:Name="resizingPanelOuter" Orientation="Vertical">
                <avalon:DocumentPane x:Name="documentPaneMain"/>
                <avalon:DockablePane x:Name="dockablePaneBottom">
                    <views:WindowMessages x:Name="MessageWindow"/>

I've tried with the standard 1.3 and the latest version rebuild from source.

Jan 10, 2011 at 1:50 PM

I fixed it by explicitly setting the Binding mode to TwoWay for the ActiveDocument. Isn't TwoWay the default?

Jan 13, 2011 at 9:43 PM

No. :) If you look at the source code for DockingManager and check out the registration for the Dependency property ActiveDocument, the default binding mode isn't set.  If a binding mode isn't specified, then it defaults to OneWay. :)

Jan 14, 2011 at 7:43 AM

Thanks! Always good to learn.