我的目标是实时更新记录列表视图。
在我设置的加载页面中:
List<Myobjetcs> myitems = new List<Myobjects>();
...
...
listView.IsVisible = false;
listView.RowHeight = 55;
listView.IsPullToRefreshEnabled = true;
listView.Refreshing += ListView_Refreshing;
listView.ItemTapped += ListView_ItemTapped;
listView.SeparatorVisibility = SeparatorVisibility.None;
listView.SeparatorColor = Color.Black;
listView.ItemsSource = myitems;
每 10 秒(使用 API)他们将随机更新数据,只有几条记录。我的目标是在不刷新列表视图的情况下更新项目......并且不将 ItemSource 设置为 null 然后重新分配数据。
public async void setSuperficie()
{
//here i receive the result of API (every 10 seconds) and update record listview.
}
我尝试使用 for 循环滑动 ItemSource 并更新数据,但不起作用。
有可能吗?
listView.ItemsSource[index].Property = Value;