We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Deleting rows bound to an Observable Collection

Thread ID:

Created:

Updated:

Platform:

Replies:

108265 Apr 10,2013 06:55 PM UTC Apr 12,2013 11:45 AM UTC WPF 3
loading
Tags: GridControl
Todd Lichtas
Asked On April 10, 2013 06:55 PM UTC

I have a GridDataControl in WPF that allows the selected row to be deleted by pressing the "delete" key.  I need to capture some information from the record being deleted, but I cannot find the event that fires when the record is being deleted

Divya A [Syncfusion]
Replied On April 11, 2013 12:45 PM UTC

Hi Todd,

 

Thank you for using Syncfusion products.

 

You can achieve your requirement by handling CollectionChanged event. This event fires whenever a change is done to the underlying Collection like adding, deleting, moving records. From the argument e.Action you can find whether the event is invoked while adding, deleting, or moving records. The deleted records can also be retrieved from the argument e.OldItems.

 

 

Code Snippet:

 

this.SyncGrid.ModelLoaded += new EventHandler(SyncGrid_ModelLoaded);

 

void SyncGrid_ModelLoaded(object sender, EventArgs e)

 {

    this.SyncGrid.Model.View.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(View_CollectionChanged);

 }

 

void View_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)

 {

    if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)

    {

       var Arraylist = ((System.Collections.ArrayList.ReadOnly(e.OldItems)));

       var Item = ((Products)Arraylist[0]);

    }

 }

 

 

Please let us know if you need further assistance.

 

Regards,

Divya.


Todd Lichtas
Replied On April 11, 2013 05:18 PM UTC

Excellent, exactly what I was looking for.  Thank you.
 
Todd

Divya A [Syncfusion]
Replied On April 12, 2013 11:45 AM UTC

Hi Todd,

 

Thanks for your update.

 

Please let us know if you need further assistance and we will be happy to assist you.

 

Regards,

Divya.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;