How to update the GridView after binded itemsource is updated in UWP?

こ雲淡風輕ζ 提交于 2019-12-24 17:23:54

问题


I need to refresh the GridView when values changed in the List collection. Actually I have bind the List as itemsource for the GridView. Where i have changed the List values but which could not relected in the GridView. How to acheive this in UWP?


回答1:


use ObserableListCollection

and

yourGridviewOrListview1.ItemsSource = null;
yourGridviewOrListview1.ItemsSource = SingletonClass.YourObList;



回答2:


To update the GridView if entries in your list are added, removed or moved you should use an ObservableCollection instead of a List.

To update GridView entries if properties of the list entries change the class of your list entries needs to implement INotifyPropertyChanged and also use databinding in the templates the GridView uses to display your list entries.



来源:https://stackoverflow.com/questions/37722777/how-to-update-the-gridview-after-binded-itemsource-is-updated-in-uwp

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