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
![Untitled](https://user-images.githubusercontent.com/2129700/77847368-ddf78d00-71bc-11ea-90a0-81baf21020a6.png)
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).
![Untitled1](https://user-images.githubusercontent.com/2129700/77846651-ce297a00-71b7-11ea-8f7c-4218c9782ea5.png)
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:
![Untitled2](https://user-images.githubusercontent.com/2129700/77846874-67a55b80-71b9-11ea-8ec8-d0cd953c02fb.png)
Verify the branches shown and click Pull-Request:![Untitled3](https://user-images.githubusercontent.com/2129700/77847046-61fc4580-71ba-11ea-8d8c-c9623ce85b13.png)
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.