Skip to content
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

AvalonDock: Hidden anchorable cannot be shown again #19

Closed
Dirkster99 opened this issue Apr 23, 2019 · 2 comments
Closed

AvalonDock: Hidden anchorable cannot be shown again #19

Dirkster99 opened this issue Apr 23, 2019 · 2 comments

Comments

@Dirkster99
Copy link
Owner

Dirkster99 commented Apr 23, 2019

xceedsoftware/wpftoolkit#1457

Consider specific use case:
54200542-edca0380-44cb-11e9-974a-95bc1f581d45

When invoking user actions in the order:

Hide Screen3 // LayoutAnchorable.Hide()
Close Screen2 // LayoutAnchorable.Clolse()
Show Screen3 // LayoutAnchorable.Show()

the Screen3 does not re-appear.

When invoking only steps 1 & 3 - the Screen3 appears as expected.

Sample project attached: Test-bug.zip

@Dirkster99
Copy link
Owner Author

Dirkster99 commented Apr 23, 2019

The solution to this problem is quit involved.

The problem appears to be that the Docking framework has a:

which are uesd to relate items back to where they where before they are being hidden. These properties are necessary because the LayoutRoot clears out empty container and implements a CollectGarbage() method to really remove hidden items from memory and view:
LayoutRoot.CollectGarbage()

But the CollectGarbage() method also removes items that appear to be empty but are referenced via the LayoutContent.PreviousContainer property.

This is why this resolution adds another guarding statement in the LayoutRoot.CollectGarbage() method to not remove a LayoutAnchorGroup if it appears to be empty but is still referenced via the LayoutContent.PreviousContainer property.

To make this work, the code that invokes the LayoutRoot.CollectGarbage() method in LayoutContent.CloseInternal() is extended such that a PreviousContainer property is changed to its Parent property if it points to an element that is likely to be removed next.

Additional testing has shown that the LayoutAnchorable.Show() method has to be extended with a:
Parent = previousContainerAsLayoutGroup; stement in order toggle its property from:

  • this.IsHidden == true to
  • this.IsHidden == false

All required changes for this solution can be found in a seperate branch:
https://github.com/Dirkster99/AvalonDock/tree/Issue19

@Dirkster99
Copy link
Owner Author

Fixed with
#22
#23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant