问题
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