How to stop Wpf Tabcontrol to unload Visual tree on Tab change

时光总嘲笑我的痴心妄想 提交于 2019-11-26 09:44:45

问题


Hi My usercontrols placed in tabs are unloaded and loaded every time the tabs are changed.It creates some unnecessary lag in the application.I am looking for some way to fix this behavior.I know i have to subclass tabcontrol to change this behavior but how..?


回答1:


You can find two different approaches to prevent this in this StackOverflow question:

  • WPF TabControl - how to preserve control state within tab items (MVVM pattern)

I recommend:

  • Keeping the WPF Tab Control from destroying its children


来源:https://stackoverflow.com/questions/5038107/how-to-stop-wpf-tabcontrol-to-unload-visual-tree-on-tab-change

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!