I have a simple grid consisting of a checkbox and a name column that serves as a multi-select tool. Requirements says that whenever the user click a checkbox, the list of all checked items are processed immediately (process is basically a visual refresh of some other lists).
The grid's DataSource is binded to a list in my ViewModel. When the ValuedChanged event of the checkbox field is fired, the ViewModel's list is not updated yet and result in an incorrect processing (the just-clicked row is not updated in the ViewModel).
What should I do? Force the updating of the ViewModel's list in my ValueChanged event?
Here's my grid:
<igDP:XamDataGrid x:Name="FilteredGrid" DataSource="{Binding FilteredAnimalList}" >
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings ExpansionIndicatorDisplayMode="Never" AutoGenerateFields="False" RecordSelectorLocation="None" LabelLocation="SeparateHeader" />
</igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:FieldLayout.Fields>
<igDP:Field Name="Status" Label=" " Width="30" x:Name="StatusField" >
<igDP:Field.Settings>
<igDP:FieldSettings>
<igDP:FieldSettings.EditorStyle>
<Style TargetType="{x:Type igEditors:XamCheckEditor}">
<EventSetter Event="ValueChanged" Handler="StatusField_ValueChanged" />
</Style>
</igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="Name" />
</igDP:FieldLayout.Fields>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
Hello,
Try invoking the EndEditMode(...) method of the value editor (XamComboEditor) so that the changes can be pushed back to the underlying object.
I assume you meant XamCheckEditor.
How do I get access to the currently editing instance of XamCheckEditor from the ValueChanged event?
The sender parameter of the ValueChanged event is actually the editor.
Problem solved by calling ((XamCheckEditor)sender).EndEditMode(true, true); in the ValueChanged event.
Thanks.