Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5124
Allow editing only in the AddNewRow
posted

A XamDataGrid customer recently asked how to allow editing only in the cells of the AddNewRow, while preventing editing in the cells of the committed data rows.  ONe way to do this is to handle the XamDataGrid's EditModeStarting event and Cancel the same event when the active record is not a "special" record.  This will prevent edit mode from starting in the existing data rows.

I hope this is helpful to others attempting the same thing...

private void XamDataGrid1_EditModeStarting(object sender, Infragistics.Windows.DataPresenter.Events.EditModeStartingEventArgs e)

{

 

 

 

  XamDataGrid grid = sender as XamDataGrid;

 

 

if (grid != null)
  {
   
if(grid.ActiveRecord.IsSpecialRecord)
      return;

  e.Cancel = true;
 }
}