如何定期刷新Xamarin形式的ContentPage中的ListView [英] How to refresh ListView in ContentPage in xamarin forms periodically

查看:179
本文介绍了如何定期刷新Xamarin形式的ContentPage中的ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在内容页面中有一个列表视图,列表视图项目是从SQLite中选取的.我想定期刷新页面,以便能够显示插入sql lite的最新项目. 1.当我第一次在本地数据库中添加"该记录的记录状态时,将显示列表项目",并且该项目的状态将显示为"[EmployeeNo]排队,等待5分钟后将被同步" . 2. 5分钟后,所有本地数据库[Sqlite]将与实际的sql服务器同步,然后该记录的状态将在本地数据库中更新为已完成",然后我要显示"[EmployeeNo]它已完成"的状态"自动显示在列表视图中.

I have a List-View in the content page, List view Items are picked from the SQLite. I want to refresh the page periodically so that I can able to show the latest items inserted in the sql lite. 1. When the first time I added record status of that record is "queued"in local db, List Item will be displayed and status of that Item will be shown as "[EmployeeNo] it is queued After 5 minutes it will be synced". 2.After 5 minutes,All local db [Sqlite] will be synced with the actual sql server, Then status of that record will be updated to "completed" in local db,Then status I want to show "[EmployeeNo] it is completed" in list view automatically.

推荐答案

使用ObservableCollection<T>作为ItemSource-每当添加或删除项目时,它将自动更新UI

Use an ObservableCollection<T> as your ItemSource - it will automatically update the UI whenever items are added or removed from it

这篇关于如何定期刷新Xamarin形式的ContentPage中的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆