diff --git a/source/Components/AvalonDock/Controls/AnchorablePaneTitle.cs b/source/Components/AvalonDock/Controls/AnchorablePaneTitle.cs index 1b4c542a..f8a56276 100644 --- a/source/Components/AvalonDock/Controls/AnchorablePaneTitle.cs +++ b/source/Components/AvalonDock/Controls/AnchorablePaneTitle.cs @@ -63,7 +63,7 @@ public LayoutAnchorable Model protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e) { if (Model != null) - SetLayoutItem(Model.Root.Manager.GetLayoutItemFromModel(Model)); + SetLayoutItem(Model?.Root?.Manager?.GetLayoutItemFromModel(Model)); else SetLayoutItem(null); } diff --git a/source/Components/AvalonDock/Controls/LayoutAnchorableControl.cs b/source/Components/AvalonDock/Controls/LayoutAnchorableControl.cs index aff092e0..a24c5c2c 100644 --- a/source/Components/AvalonDock/Controls/LayoutAnchorableControl.cs +++ b/source/Components/AvalonDock/Controls/LayoutAnchorableControl.cs @@ -67,7 +67,7 @@ protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e) if (Model != null) { Model.PropertyChanged += Model_PropertyChanged; - SetLayoutItem(Model.Root.Manager.GetLayoutItemFromModel(Model)); + SetLayoutItem(Model?.Root?.Manager?.GetLayoutItemFromModel(Model)); } else SetLayoutItem(null); diff --git a/source/Components/AvalonDock/Controls/LayoutDocumentControl.cs b/source/Components/AvalonDock/Controls/LayoutDocumentControl.cs index 5db5bcbc..0ceeaaea 100644 --- a/source/Components/AvalonDock/Controls/LayoutDocumentControl.cs +++ b/source/Components/AvalonDock/Controls/LayoutDocumentControl.cs @@ -63,7 +63,7 @@ protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e) if (Model != null) { Model.PropertyChanged += Model_PropertyChanged; - SetLayoutItem(Model.Root.Manager.GetLayoutItemFromModel(Model)); + SetLayoutItem(Model?.Root?.Manager?.GetLayoutItemFromModel(Model)); } else SetLayoutItem(null);