Skip to content

LayoutRoot.ActiveContent is null after adding an anchored document #335

Open
@Khaos66

Description

@Khaos66

There seems to be a problem with LayoutRoot.ActiveContent beeing null after adding an anchored doc.

This is what I know so far:
DockingManager.AnchorablesSourceElementsChanged will create a new LayoutPanel to host both inner docs and anchored docs.

This results in this call stack

AvalonDock.dll!AvalonDock.Layout.LayoutElement.OnRootChanged(AvalonDock.Layout.ILayoutRoot oldRoot, AvalonDock.Layout.ILayoutRoot newRoot) Line 129	C#
AvalonDock.dll!AvalonDock.Layout.LayoutElement.Parent.set(AvalonDock.Layout.ILayoutContainer value) Line 81	C#
AvalonDock.dll!AvalonDock.Layout.LayoutRoot.RootPanel.set(AvalonDock.Layout.LayoutPanel value) Line 103	C#
AvalonDock.dll!AvalonDock.Layout.LayoutRoot.RemoveChild(AvalonDock.Layout.ILayoutElement element) Line 313	C#
AvalonDock.dll!AvalonDock.Layout.LayoutGroup<AvalonDock.Layout.ILayoutPanelElement>.Children_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) Line 228	C#
[External Code]	
AvalonDock.dll!AvalonDock.DockingManager.AnchorablesSourceElementsChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) Line 2444	C#

In LayoutElement.OnRootChanged the element is removed from the old root.
One of the elements had to be ActiveContent on the old root. After removing the element from the old root the ActiveContent property is null, which is correct.
But when adding the previous element to new new root it is not "activated" correctly, so ActiveContent will stay on its initial value of null after this.

All of this results in ActiveContext beeing null for the LayoutRoot and ActiveContextChanged not beeing fired correctly, when selecting another tab

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions