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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Looking for a sampke that adds, deletes in C# code

Thread ID:





94161 Apr 26,2010 08:54 PM UTC May 3,2010 08:44 AM UTC WPF 4
Tags: GridControl
David Mecteaux
Asked On April 26, 2010 08:54 PM UTC


I am looking for some sample code that lets you delete, insert, add a row in C# to the grid. I am also looking for some code that will do this with the currently selected row. I looked through a ton of the samples but didn't come across what I was looking for...

Mohamed Suhaib Fahad A. [Syncfusion]
Replied On April 28, 2010 10:07 AM UTC

Hi David,

The v8.2 Install comes with a Stock Exchange Demo sample,

Syncfusion\EssentialStudio\\WPF\Grid.WPF\Samples\3.5\WindowsSamples\Grid Data Control - Advanced\Stock Exchange Demo\CS

This sample does Add/Remove/Updates in the underlying ItemsSource that is bound to the GridDataControl. The Grid would automatically reflect those changes.

If you want to delete the SelectedItem, In your code you can do something as below, Consider Orders is the collection bound to the Grid,


Please let me know if this helps.


David Mecteaux
Replied On April 28, 2010 01:38 PM UTC

Hi thanks for the response.

I am curious....if you reorder the data in the grid (like with a sort) and you use the code that you showed me....that will still delete the correct row?

David Mecteaux
Replied On April 28, 2010 02:09 PM UTC

Actually I do have one additional question. How can you get the integer index of the row that is selected on the grid?

Varun P [Syncfusion]
Replied On May 3, 2010 08:44 AM UTC

Hi David,

Sorry for the delay in getting back to you.

Regarding the sorting, this looks like a bug, We would like you to create an incident with the Forum Title as the Incident description for further follow up.

Regarding to get the integer index of the selected row, you can use the following code.

var rowIndex = this.dataGrid.Model.CurrencyManager.CurrentRecordIndex;

Please let me know if you have any queries.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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