Observablecollection listbox not updating

Rated 4.30/5 based on 531 customer reviews

The Observable Collection on the other hand is very easy to deal with - it simply requires you to use this specific list type in those situations where you want changes to the source list reflected in a binding destination.

That is not to say that the listbox isn't displaying anything however, it is updating to display any new values added to the collection but these only ever reflect the properties of the first moment they enter the collection.

Thanks, it's the Is Editable issue that is causing the problem for us - I wasn't aware of that specific behaviour.

My example data item doesn't implement INotify Property Changed, but our actual data items do, so they update correctly.

This will make the Add and Delete button work, but it won't do anything for the "Change name" button, because the change will happen on the bound data object itself and not the source list - the second step will handle that scenario though.

The second step is to let our custom User class implement the INotify Property Changed interface.

observablecollection listbox not updating-21

observablecollection listbox not updating-12

observablecollection listbox not updating-57

observablecollection listbox not updating-29

The app has to be restarted to see that the item is deleted.This is the price you will have to pay if you want to bind to your own classes and have the changes reflected in the UI immediately.Obviously you only have to call Notify Property Changed in the setter's of the properties that you bind to - the rest can remain the way they are.But one more issue with i OS is that when you exit the app by pressing the Home button, the app is actually in the suspended state and a snapshot of the current page is saved.So when you restart the app, the last snapshot stored is displayed.

Leave a Reply