and showing it on the GridView in my WPF project. The problem I am facing is, when i delete an" />
开发者

Refresh ObservableCollection by changes on a remote server

开发者 https://www.devze.com 2023-03-12 22:21 出处:网络
I am fetching data from an URI and parseing the xml to populate my ObservableCollection<\"classname\"> and showing it on the GridView in my WPF project. The problem I am facing is, when i delete an

I am fetching data from an URI and parseing the xml to populate my ObservableCollection<"classname"> and showing it on the GridView in my WPF project. The problem I am facing is, when i delete an entry from the ObservableCollection, event is tri开发者_如何学Goggered and GridView is updated. However if an entry is updated on the server from which i am getting the data from, no event is triggered on the ObservableCollection and list is not updated.

I have tried reloading the complete object list again on click event but still no changes can be viewed in the GridView. Any idea how to do this?


ObservableCollection only reports adding, removing or replacing items in it. It can't know anything about changes in the internal structure of the stored objects.

If you want changed in your objects reflected in the GUI, you should implement INotifyPropertyChanged.

Alternative approach would be to remove and then add back the item that changed, but it's not as clean as the previous solution.

0

精彩评论

暂无评论...
验证码 换一张
取 消