Skip to content

Commit

Permalink
Merge pull request #336 from Khaos66/activeContent
Browse files Browse the repository at this point in the history
Keep ActiveContent when switching RootPanel
  • Loading branch information
Dirkster99 authored Mar 5, 2022
2 parents d68b926 + 5a03954 commit 141525e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/Components/AvalonDock/Layout/LayoutRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,19 @@ public LayoutPanel RootPanel
{
if (_rootPanel == value) return;
RaisePropertyChanging(nameof(RootPanel));
var activeContent = ActiveContent;
var activeRoot = activeContent?.Root;
if (_rootPanel != null && _rootPanel.Parent == this) _rootPanel.Parent = null;
_rootPanel = value ?? new LayoutPanel(new LayoutDocumentPane());
_rootPanel.Parent = this;
if (ActiveContent == null && activeRoot == this && activeContent != null)
{
ActiveContent = activeContent;
if (ActiveContent != activeContent)
{
ActiveContent = activeContent;
}
}
RaisePropertyChanged(nameof(RootPanel));
}
}
Expand Down

0 comments on commit 141525e

Please sign in to comment.