As you can see in the code below, i use 2 models with the property "Text". The DataContext outside the DockingManager is set to VMMain, inside to VMChild. In BindingHelper.cs at line 52 dependencyObject.ClearValue() clears the inner DataContext and the trys to bind to the "Text"-property of VMMain. Because this property is readonly, it can't be bound in "two way"-mode and an exception is thrown. I think, the ClearValue-Line isn't necessary, because BindingOperations.SetBinding should reset the bindings already, but i'm not sure about that.
public class VMChild
{
public string Text { get; set; }
}
public class VMMain
{
private VMChild _child = new VMChild();
public VMChild Child
{
get { return this._child; }
}
public string Text { get; private set; }
}
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.DataContext = new VMMain();
}
}
public class VMChild
{
public string Text { get; set; }
}
public class VMMain
{
private VMChild _child = new VMChild();
public VMChild Child
{
get { return this._child; }
}
public string Text { get; private set; }
}
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.DataContext = new VMMain();
}
}