I have a simple form with datagrid and a button. Items in the datagrid are bound to ObservableCollection
of customers
. The customer
implements INotifyPropertyChanged
interface. Each customer has a deleted
property (type bool). I set a filter for the customers default view to filter out deleted customers based on the deleted
property. So far it works.
Then I add an event for the button that marks selected customer as deleted. The problem is the grid is not updated after setting selected_customer.deleted = true
. The deleted customer is still visible. The column bound to deleted
property updates correctly. To remove the customer from the grid, I have to manually call Refresh()
method of the customers default view.
Why is not the datagrid updated automaticaly when I use ObservableCollection
and the customer implements INotifyPropertyChanged
interface? How to make it update automatically?