Hello,
I was looking at this sample: https://www.syncfusion.com/faq/blazor/data-binding/how-do-you-show-real-time-data-updates-using-observablecollection
I have 2 questions:
private void NotifyPropertyChanged(String propertyName)
{
if (PropertyChanged != null) //this is always null
{
//this is never called
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
2. If I remove the INotifyPropertyChanged interface from the OrdersDetailsObserveData class, the grid still updates the customer ID. I thought that INotifyPropertyChanged had to be implemented for this to work. What am I missing?
Thank you for your assistance.
Hello,
It's been over a month. Can I get a response to this please?
Thank you
Hi Rav,
Sorry for the inconvenience and sorry for the delay in getting back to you.
While binding Oberservable collection data, the PropertyChanged event value will get only if we have added the handler to that Observable collection CollectionChanged event. If we have not added that CollectionChanged event handler, then it won’t get the PropertyChanged value.
Also, for binding the Observable data to the normal HTML table, then it is not needed to implement the INotifyPropertyChanged interface. Suppose if we bind any normal list data to an HTML table. If we change/ update any data, then it will change automatically.
For the Grid component, we have added the CollectionChanged event handler in our source. So while updating the value while using Blazor Grid, you can get the PropertyChanged value. Find the below documentation for your reference.
https://blazor.syncfusion.com/documentation/datagrid/data-binding#observable-collection
Please let us know if you have any concerns.
Regards,
Rahul