1

I have a model that is bound to the view Listview using viewmodel observablecollection.

The model implements INotifyPropertyChanged interface. So if there is any change in any of the properties the view is getting updated.

But if any new row gets added to the database the view is not getting updated. In my case a third party webservice writes data to the database. so whenever data gets added/deleted i want to update the UI.

How can I achieve this?

ViewModel.cs

Public ObservableCollection<Employee> EmployeeList {get; set;}

View:

Listview.ItemsSource = viewmodel.EmployeeList
Eugene Podskal
  • 10,270
  • 5
  • 31
  • 53
  • I have never used it myself, but I can point you to look at [Query Notifications](https://msdn.microsoft.com/en-us/library/t9x04ed2(v=vs.110).aspx). For example, here are few EF related articles - https://code.msdn.microsoft.com/How-to-use-SqlDependency-5c0da0b3 and http://stackoverflow.com/questions/17334935/sqldependency-with-entityframework-6-async. – Eugene Podskal Mar 28 '15 at 14:00

1 Answers1

0

You can write your own class that raises and event every time and object is added and listen to it.

Also , the following question has more details

how to get the notification on change in ObservableCollection object

Community
  • 1
  • 1
shat90
  • 405
  • 3
  • 8