implements INotifyCollectionChanged for add and remove

Hi, i need delete and remove list child. This is my project attach...


i have another form with 

  view.DataGrid.AutoGenerateRelations = true; 



 is possible too?


Attachment: CS_b8cbd772.7z

5 Replies 1 reply marked as answer

DM Dhanasekar Mohanraj Syncfusion Team August 3, 2022 03:31 PM UTC

Hi Sergio Ayala,

We regret to let you know that we are a little unclear about your scenario. Could you please below things,

  1. Can you please share your exact requirement?     

  2. Provide more details about your scenario with image illustrations.

It will be helpful for us to check on it and provide you with the solution at the earliest.

Regards,

Dhanasekar M.



SA Sergio Ayala August 3, 2022 06:30 PM UTC

Hi,


1- implements INotifyCollectionChanged interface.

Where should the implementation go? Should I have an observable list or is it not necessary?


I attach the project


2- I have another form where the elimination of a "child" row works for me. But it doesn't update the UI.

I want to remove a "detail" row and not the header. When I delete a detail row, it is deleted but not displayed in the UI. The glyph disappears but I have to open another one so that the one I just deleted is referenced.

I'm just using an observable list and not the "INotifyPropertyChanged" interface and it does update the UI. That's weird?

Captura de pantalla 2022-040.jpg



Attachment: CS_d7b261f2.zip



DM Dhanasekar Mohanraj Syncfusion Team August 4, 2022 04:30 PM UTC

Hi Sergio Ayala,

Please find the response for the reported issue below,

Reported issue

Response

 

 

Implements INotifyCollectionChanged interface.


Where should the implementation go? Should I have an observable list or is it not necessary?

 

 

If the data source implements the INotifyCollectionChanged interface, then SfDataGrid control will automatically refresh the UI when an item is added, removed, or while the list cleared. When you add or remove the item in ObservableCollection, SfDataGrid automatically refreshes the UI as ObservableCollection implements INotifyCollectionChanged. But when you do the same in List, SfDataGrid will not refresh the UI automatically.

 

The recordPropertyChanged event is raised when the DataModel property value is changed if the DataModel implements the INotifyPropertyChanged interface. The event receives two arguments namely the sender that handles the DataModel and PropertyChangedEventArgs as objects.

 

For more information related to INotifyCollectionChanged  and property changed, please refer to the below user guide documentation link,

 

UG Link:

https://help.syncfusion.com/wpf/datagrid/data-binding

 

https://help.syncfusion.com/wpf/datagrid/data-binding#recordpropertychanged

 

 

 

I have another form where the elimination of a "child" row works for me. But it doesn't update the UI.

I want to remove a "detail" row and not the header. When I delete a detail row, it is deleted but not displayed in the UI. The glyph disappears but I have to open another one so that the one I just deleted is referenced.

I'm just using an observable list and not the "INotifyPropertyChanged" interface and it does update the UI. That's weird?

 

 

Currently, we are checking the reported issue with the provided sample on our end. We need two more business days to validate this. We will update you with further details on August 08, 2022.

 

We appreciate your patience until then.

 


Regards,

Dhanasekar M.



SA Sergio Ayala August 4, 2022 11:08 PM UTC

Hi, I just changed my "details" related list (not header). I changed from INumerable to Observable and "voi lá". Now deleting the row works without even implementing the INotifyCollectionChanged interface. So why do they ask me to implement it if it works without it? no entiendo. Gracias por responder...



DM Dhanasekar Mohanraj Syncfusion Team August 5, 2022 02:23 PM UTC

Hi Sergio Ayala,

Thanks for the update.

If you need to get the notifications while performing any manipulation like Add or Remove in the underlying collection you need to implement INotifyCollectionChanged interface. Now, that you are using ObservableCollection, so you can get those notifications in the underlying collection itself. Because ObservableCollection itself implements INotifyCollectionChanged. And we are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you.

Regards,

Dhanasekar M.


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Marked as answer
Loader.
Up arrow icon