-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LayoutRoot.ActiveContent is null after adding an anchored document #335
Comments
Not sure if its the best solution but this is what fixed it for me: Replace /// <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 |
oh btw. to produce this issue you just have to add an anchorable via code to the |
@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 be
ActiveContent
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, so
ActiveContent
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 tabThe text was updated successfully, but these errors were encountered: