Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3627
Adding item to ObservableCollection DataSource causes grid to clear
posted

I have to grids each bound to ObservableCollections of the same data type.

If I programmatically remove an item from one collection and add it to the other collection, I get the following behavior:

1. The grid bound to the collection that the item is being removed from correctly updates.

2. The grid bound to the collection that the item is added to clears out all data, displaying only field labels. If I set the DataSource to null and then back to the collection, the grid redisplays correctly, showing the newly added data.

I'm building an interactive tool, and the top grid had grouping. An ideal user experience would leave group expansions in place (as the user had them) and simply add the new data to the correct group, or create a new group if need be (as is the case in my test).

Is there are better way to accomplish this, other than completely recreating the list each time an item is added, which is not good, at all.

Thank you.

Parents Reply Children
No Data