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
160
AddRecord is overwritten
posted

When adding a new record in the XamDataGrid I use the following to initialize the added record

private void NotesViewGrid_InitializeTemplateAddRecord(object sender, Infragistics.Windows.DataPresenter.Events.InitializeTemplateAddRecordEventArgs e)
        {
             e.TemplateAddRecord.SetCellValue(e.TemplateAddRecord.FieldLayout.Fields[0], notesViewModel.GetDefaultNote().Priority);
             e.TemplateAddRecord.SetCellValue(e.TemplateAddRecord.FieldLayout.Fields[2], notesViewModel.GetDefaultNote().Reviewer);
             e.TemplateAddRecord.SetCellValue(e.TemplateAddRecord.FieldLayout.Fields[3], notesViewModel.GetDefaultNote().Updated);
        }

When the record is displayed the values are correctly initialized and displayed. However as soon as the user edits a value in a cell of the added row all the other cells loose their default value.

This occurs after the NotesViewGrid_EditModeStarted event as soon as the user enters a value in the cell. A new DataItem gets created on cell edit wiping out all the initialized values. How does one prevent this from happening?

 

Parents
No Data
Reply
  • 17559
    posted

    Hello neojones,

     

    I was looking into the issue you are describing and I tested it with handling ItnitilizeTemplateAddRecord event and setting  values for the cells. However I am not able to reproduce the behavior you are describing. Could you please modify the attached sample in order to represent the issue, so I can continue investigating this.

     

    Thanks in advance.

    InitializeTemplateAddRecordIssue.zip
Children
No Data