Search code examples
c#wpfdata-bindingdatagridcell

some cells of the DataGrid doesn't show contents unless double clicked


I'm making a binded DataGrid in WPF application with C#, the binding works correctly as If I add or remove objects from the observablecollection list. However, when editing the properties of the inner objects. some reflect on the DataGrid cells and some doesn't.

I have implemented INotifyPropertyChanged in the class, added the property and NotifyPropertyChanged methods. I set binding on the XAML. Everything works except this thing about editing properties of inner objects.

[Before editing properties (can add/remove easily and reflects on UI)] enter image description here

[After editing properties of inner objects, some doesn't reflect on UI] enter image description here


Solution

  • The proper way I found to solve this was simply by replacing the whole item inside the ObservableCollection List with new item (or simply put, clear and refill the list) This will update the UI correctly. Seems like updaing inner properties of the items in the list is not correctly handled this way.