Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get DataGrid row data after user has finished editing row?

I want to validate what the user has entered immediately after the user has finished entering a row in a datagrid.

What event should I be looking at, and how do I retrieve the row data? Or even better, the object it's bound to?

like image 803
mpen Avatar asked Jan 12 '11 21:01

mpen


2 Answers

Use the RowEditEnding event.

private void DataGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
{
  YourObject obj = e.Row.Item as YourObject;
  if (obj != null)
  {
     //see obj properties
  }
}
like image 191
VoodooChild Avatar answered Sep 24 '22 00:09

VoodooChild


  1. Event RowEditEnding
  2. Data should be in e.Row.DataContext/e.Row.Item
like image 30
H.B. Avatar answered Sep 23 '22 00:09

H.B.