WPF Data Grid Inline editing

Jun 6, 2009 at 6:13 PM

Hi I am new to WPF. How can i enable inline data editing in wpf datagrid? I have tried with CellEndEdting event with no success. It does give me the current editing row but with the old binded values. These is my datagrid xaml markup. 

<toolkit:DataGrid x:Name="monthGrid" ItemsSource="{Binding}" Height="450"

                BorderThickness="1" CellEditEnding="monthGrid_CellEditEnding"

                RowBackground="CadetBlue" AlternatingRowBackground="BurlyWood"

                FontSize="15" />

At the code behind:

private void monthGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) {

            DataRow row = (e.Row.DataContext as DataRowView).Row;

            DataRow row2 = (e.EditingElement.DataContext as DataRowView).Row;

            DataRow row3 = (monthGrid.SelectedItem as DataRowView).Row;


As you can see i have tried 3 ways but none of them gives me the expected result. Whatever I am typing in the grid cell is not catching by this event. It comes with initial value binding. Am i missing something? 

Jun 8, 2009 at 12:32 PM

RowEditEnding fires as the row edit is ending, not after it has ended. I have found row validation rules to be the easiest way to accomplish what I believe you are trying to do. Those also allow you to react to the data and indicate to the user if there is an error at the record level.

Nov 18, 2010 at 4:47 AM

Hi Hassan,

We have a free downloadable dynamic inline editable grid which may be of some use to you. Have a look and see what you think - http://www.mokom.com.au/services-solutions.aspx