Open Khaos66 opened 2 years ago
Not sure if its the best solution but this is what fixed it for me:
Replace RootPanel
in LayoutRoot
with this:
/// <summary>Gets/sets the root layout panel that contains the <see cref="LayoutDocumentPane"/>.</summary>
public LayoutPanel RootPanel
{
get => _rootPanel;
set
{
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));
}
}
Not sure why, but setting ActiveContent
once is not enough. It still is null after the first time. When called twice however the value is correctly set.
I suppose some relation with DockingManager.OnLayoutRootPropertyChanged
oh btw. to produce this issue you just have to add an anchorable via code to the AnchorableSource
. This should trigger the issue
@Dirkster99 can this issue be closed? It seems to be that the PR should have fixed this issue - even tho the solution might be not so nice...
Yes it's all good now đź‘Ť
There seems to be a problem with
LayoutRoot.ActiveContent
beeingnull
after adding an anchored doc.This is what I know so far:
DockingManager.AnchorablesSourceElementsChanged
will create a newLayoutPanel
to host both inner docs and anchored docs.This results in this call stack
In
LayoutElement.OnRootChanged
the element is removed from the old root. One of the elements had to beActiveContent
on the old root. After removing the element from the old root theActiveContent
property isnull
, which is correct. But when adding the previous element to new new root it is not "activated" correctly, soActiveContent
will stay on its initial value ofnull
after this.All of this results in
ActiveContext
beeing null for theLayoutRoot
andActiveContextChanged
not beeing fired correctly, when selecting another tab