diff --git a/source/Components/AvalonDock/DockingManager.cs b/source/Components/AvalonDock/DockingManager.cs
index e8bd207b..f71d2cb9 100644
--- a/source/Components/AvalonDock/DockingManager.cs
+++ b/source/Components/AvalonDock/DockingManager.cs
@@ -27,17 +27,17 @@ This program is provided to you under the terms of the Microsoft Public
namespace AvalonDock
{
- ///
- ///
- ///
- /// The is the custom control at the root of the visual tree.
- /// This control is the core control of AvalonDock.
- /// It contains core dependency properties, events, and methods to customize and
- /// manage many aspects of the docking framework.
- ///
- ///
- ///
- [ContentProperty(nameof(Layout))]
+ ///
+ ///
+ ///
+ /// The is the custom control at the root of the visual tree.
+ /// This control is the core control of AvalonDock.
+ /// It contains core dependency properties, events, and methods to customize and
+ /// manage many aspects of the docking framework.
+ ///
+ ///
+ ///
+ [ContentProperty(nameof(Layout))]
[TemplatePart(Name = "PART_AutoHideArea")]
public class DockingManager : Control, IOverlayWindowHost//, ILogicalChildrenContainer
{
@@ -1731,6 +1731,9 @@ internal void ExecuteCloseCommand(LayoutDocument document)
RemoveLogicalChild(uIElement);
DocumentClosed?.Invoke(this, new DocumentClosedEventArgs(document));
+ //get rid of the closed document content
+ document.Content = null;
+
int indexOfDocumentToSelect = indexOfDocumentToRemove - 1;
if (indexOfDocumentToSelect < 0)
@@ -2198,9 +2201,9 @@ private TLayoutType[] GetItemsToRemoveAfterReset(IEnumerable source
var itemsThatRemain = new HashSet