简体   繁体   中英

Save UI control/page state

We have an app with chat style like the Telegram Desktop: in the right part of the window the correspondents list, in the left side - the grouped by date list of the dialog messages with the selected correspondent. Now we use Dictionary for save current state of every dialog with correspondent. By selecting correspondent we took exist control for display dialog, or create new, and bind it to ContentPresenter:

    <ContentPresenter Content="{x:Bind ViewModel.DetailsDialog, Mode=OneWay}"/>

After three or more Controls added to the dictionary, UI starts freezing (scrolling disabled etc), memory and processor is not overloaded(something about 6% of processor, and 50 mb of RAM).

So my question is how can we achieve the best performance with saving UI state of control or page?

通常,最好将状态存储在包含所有数据的视图模型类中,然后使用数据绑定将状态数据绑定到“新的”新UI实例上,而不是节省资源昂贵的UI元素。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM