I have SEVERAL XamDataGrids in my application, and I want all of them to enable the respective Save buttons as soon as the user changes a checkbox in them. This currently doesn't happen until I leave the cell or press enter etc, because the cell is still in edit mode. I know how to fix this using a post I found in code-behind:
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 my grid across the app, without putting this in code-behind for every grid? I am using MVVM and would prefer to not have any code behind, if possible. If I have to, i will, but i defintitely don't want it in the code behind in 17 different files with grids. Maybe a behavior?
You need to set the DataItemUpdateTrigger to OnCellValueChange.
Default value for all fields in a XamDataGrid
<igDP:XamDataGrid.FieldSettings>
<igDP:FieldSettings
DataItemUpdateTrigger="OnCellValueChange" />
</igDP:XamDataGrid.FieldSettings>
For an individual Field
<igDP:Field Label="" Name="IsSelected" >
<igDP:Field.Settings>
<igDP:FieldSettings DataItemUpdateTrigger="OnCellValueChange" />
</igDP:Field.Settings>
</igDP:Field>
DataItemUpdateTrigger
property is available in FieldSettings
class in NetAdvantage 2013 v. 2 or later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With