-
Notifications
You must be signed in to change notification settings - Fork 324
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
DocumentClosed event issue #195
Comments
Hi, I don't have a sample client to verify your issue :-( and so I am left to guessing at this point - but since there is:
I am wondering if this change could be the cause of this issue. Would you be able to test this with the current version 4.4 (with reference to source code project) and tell me if your issue can be fixed if we move the call to internal void ExecuteCloseCommand(LayoutDocument document)
{
if (DocumentClosing != null)
{
var argsClosing = new DocumentClosingEventArgs(document);
DocumentClosing(this, argsClosing);
if (argsClosing.Cancel) return;
}
if (!document.CloseDocument()) return;
RemoveViewFromLogicalChild(document);
DocumentClosed?.Invoke(this, new DocumentClosedEventArgs(document));
if (document.Content is UIElement uIElement)
RemoveLogicalChild(uIElement);
} |
I think the issue is at the CloseInternal() function in LayoutContent.cs as the content is explicitly set to null.
I wonder if the ExecuteCloseCommand function can be changed in order to invoke the DocumentClosed event using a new "DocumentClosedEventArgs" variable, since I need to see which content is being "closed" in order for the PRISM framework to remove it from the region? Thank you **EDIT: had mixed up the variable type suggestion (DocumentClosedEventArgs) |
@LyonJack |
@Dirkster99 Sure, I will see what I can do without breaking something, my initial guess is to invoke the event before getting rid of the content object. I will keep you posted! Thank you. :D |
@Dirkster99 Hello Dirkster, I will post a PR with the modified code, I ran the unit test project, but is there a way to see if I didn't break anything else?? |
I found that from v4.30 and up, the content property of the closing document is null, so mi PRISM app cannot remove the region since the content is null.
private void DockingManager_DocumentClosed(object sender, DocumentClosedEventArgs e) { LayoutDocument layoutDocument = e.Document; //e.Document.content is null, breaking my region behavior using prism }
The text was updated successfully, but these errors were encountered: