WPF XamDataGrid is not updated until it leaves the current cell

I have SEVERAL XamDataGrids in my application, and I want them all to include the corresponding Save buttons as soon as the user changes the checkbox in them. Currently this does not happen until I leave the cell or press the enter key, etc., because the cell is still in edit mode. I know how to fix this using the message I found in the code:

private void XamDataGrid_CellChanged(object sender, Infragistics.Windows.DataPresenter.Events.CellChangedEventArgs e)
        {
            e.Cell.Record.SetCellValue(e.Cell.Field, e.Editor.Value, true);
        }

But how can I handle this for ALL of my grid through the application without putting this in the code for each grid? I use MVVM and, if possible, prefer not to have any code. If I should, I will, but I defintitely don’t want it in the code behind in 17 different grid files. Maybe a behavior?

+4
source share
2 answers

You need to set DataItemUpdateTrigger to OnCellValueChange .

The default value for all fields in XamDataGrid

<igDP:XamDataGrid.FieldSettings>
    <igDP:FieldSettings 
        DataItemUpdateTrigger="OnCellValueChange" />
</igDP:XamDataGrid.FieldSettings>
  • I believe this can be easily applied as a style for all XamDataGrids.

For a single field

<igDP:Field Label="" Name="IsSelected" >
    <igDP:Field.Settings>
        <igDP:FieldSettings DataItemUpdateTrigger="OnCellValueChange" />
    </igDP:Field.Settings>
</igDP:Field>
+6
source

DataItemUpdateTriggera property is available in a class FieldSettingsin NetAdvantage 2013 v. 2 or later.

+1
source

All Articles