finally I got solution... we can create an object which is store row data. now i can access each cell item like that
here is code:-
private void btnEdit_Click(object sender, RoutedEventArgs e)
{
try
{
object item = MyDataGrid.SelectedItem;
gridDataContext datacontext = new gridDataContext();
int m = int.Parse((MyDataGrid.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text);
registration Registration = datacontext.registrations.Where(A => A.RegId == m).Single();
Registration.Name = (MyDataGrid.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text;
Registration.FName = (MyDataGrid.SelectedCells[2].Column.GetCellContent(item) as TextBlock).Text;
datacontext.SubmitChanges();
MessageBox.Show("Row Updated Successfully");
LoadCustomerDetail();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
}