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: The document model's view is recreated everytime the tab changes. #1582

Open
ayrtonsoftware opened this issue Apr 24, 2020 · 3 comments

Comments

@ayrtonsoftware
Copy link

When switching tabs, the view model's underlying user control is created, deleting the previous one. What I expect to happen is the tab is just switched and the previously created user control should be displayed....

@XceedBoucherS
Copy link
Collaborator

I can suggest you to try the Plus version of the Toolkit (https://xceed.com/xceed-toolkit-plus-for-wpf/), available for free for 45 days. In this version of the product, the DockingManager contains 2 new properties :
-CacheDocumentTabItems
-CacheAnchorableTabItems
When set to true, these properties make sure the tab content are loaded only once.

@ayrtonsoftware
Copy link
Author

That is not an option for me. I have seen projects that this behavior does not happen and the views are indeed not recreated. I just can't figure out how that happens.

@Dirkster99
Copy link

Dirkster99 commented May 2, 2020

You are looking at an implementation that is based on the WPF TabControl (for the display of LayoutAnchorable and LayoutDocument controls you'll see a different inheriting TabControl class here).

A not so well known fact about the WPF TabControl is that it is virtualizing its children by default. Virtualization means here that views are loaded and unloaded everytime the users switches from one tab to the other (to optimize memory usage but requiring quick load/unload implementations).

You can read this issue (and the referenced PR) to understand a solution that solves this particular problem.

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

No branches or pull requests

3 participants