Switching between documents slow
See original GitHub issueHi,
I’m having an issue with LayoutDocument
inside LayoutDocumentPane
. When I add multiple LayoutDocument
s inside the DocumentPane and if content of that LayoutDocuments has many UIElements (for example, tens of thousands of elements) switching between them is extremely slow - it seems that when clicked/switched to, LayoutDocument
recalculates something with it’s child controls, including Canvas
. Switching is super fast if hosted controls inside LayoutDocument
are simple, with normal number of child items.
Also, docking from floating position back to “pinned” state also sometimes takes long time, same like switching between documents like above.
Any way to bypass this behavior? Users will have 10-15 documents open like that in “tabs” so switching between them should be fast.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Hi,
it looks like you discovered 2 issues - the issue with the PropertyChanged might be a memory leak that occurs during switching/re-ordering tabs. I’ve already tried to close some of these issues:
but there might be more and its really hard to solve some of these because a solution might cause another side effect leading to another bug 😦 which is why I had to roll-back part of the above fixes in this commit Undoing LayoutGridControl changes commited on 2020-02-22 .
A pull request with GitHub is really easy and can be done through the web site and VS only:
Create a Fork from the AvalonDock repository

This should create a repository called matko238/AvalonDock.
Clone the forked repository to your desktop PC (I prefer using a simple app called GitHub Desktop) and use the Clone button in the Web-Interface (this requires GitHub Desktop to be installed before cloning but it should also work via the VS option - I just have not done this with VS yet).

Use Visual Studio to edit the cloned copy and commit changes via the Team Explorer (Tool Window) to your forked repository matko238/AvalonDock.
Once you are happy with your changes, and they are commited to your forked repository, you can create a Pull Request via the web interface options in your repository:

Verify the branches shown and click Pull-Request:
Use the next dialog to describe your changes in a human-readable format and click Create pull request to make the PR visible under Pull Requests in Dirkster99/AvalonDock:
This lengthy explanation makes it seem difficult but its really simple since you can do it all with the web interface and VS and I just tried to describe/screenshot all details hopping that its easy to follow. Please let me know if you have additional questions or a contribution 😃
Thank you very much for those instructions, I’ll try to push this change as soon as I test everything. Again, option should be added later on to disable this behavior if someone still wants to controls/documents be unloaded (removed from Visual tree) and loaded again when switched back to that document.
Performance is much better now (switching is almost instant) but memory leak is another issue someone more experienced should tackle.