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.

deleting from a GridDataControl which is data bound

Thread ID:





84529 Jul 1,2009 03:33 AM Jul 1,2009 08:18 AM WPF 1
Tags: GridControl
Hayden Shilling
Asked On July 1, 2009 03:33 AM

The default delete functionality of the grid when the delete key is pressed only seems to work once on the first key press so I disabled this and tried to write my own on key press (for the delete key)

int itemIndex = grid.Model.CurrencyManager.CurrentRecordIndex;

(grid.ItemsSource as ObservableCollection).RemoveAt(itemIndex);

// This works but
// CurrentRecordIndex will now be -1

// this line of code almost makes it work by setting the new current row to what it was before delete. The only problem here is that the row selector dissappears from the UI

Also when the grid is grouped the concurrency manager will return the wrong index.

Is there an easier way to delete records from a bound grid?

Mohamed Suhaib Fahad A. [Syncfusion]
Replied On July 1, 2009 08:18 AM

Hi Hayden,

Thanks for using Syncfusion products.

Deleting a row directly from the Grid is quite tricky and the internal logics that does this functionality is marked internal. The best way to do is to access the underlying source and directly remove it from the list. I have a sample created for you that does it,


Please check it out and let me know if you want any more details.

Grid.WPF Team
Syncfusion Inc.,


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.

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.