ReactiveUI - View Locator performance

感情迁移 提交于 2019-12-04 09:39:26

I believe the root cause of this issue is an implementation issue of TransitioningContentControl.

This control (which has many existing implementations all over the place, most of which originated from Silverlight one AFAICT) will cause an extra load/unload transition when navigating out of a content.

The current control will trigger Unload/Load/Unload when navigating out, instead of single Unload. This issue is referenced in many places.

When used in RxUI, this bug causes WhenActivated to be called on the leaving View, causing performance issues, especially if the current view is complex.

TransitioningContentControl should be re-written to avoid this extra transition, here's an sample implementation which doesn't suffer from this issue.

I've run into this exact same problem before.

Essentially, you want to show/hide, rather than create/destroy.

Creating a new visual tree is lots of work, and you will typically get delays of seconds or more when you switch tabs.

Now if you create everything, then collapse what you dont need and show it on demand, suddenly everything updates in an eyeblink.

It may take a bit of refactoring to do this, and the code may not look as clean, but it sure as hell runs blazingly fast.

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