I have a WPF Dev Express DxGrid that is bound to an ObservableCollection in the following way.
Private _FamilyList As New ObservableCollection(Of FamilyRecord)
MyGrid.DataSource = _FamilyList
When a user starts to enter information in the grid, I need to be able to check whether they have missed some information making it Invalid.
So, what is the best method of checking that the _FamilyList has no validation errors?
I don’t have experience w/ the DevExpress grid, but on the Xceed WPF DataGridControl there’s a property called
UpdateSourceTriggerwhich controls when the data source gets updated (when the user is finished editing an entire row, finished editing a cell, or with every key stroke). I’m sure DevExpress has a similar concept.This will give you control over when the validation happens. You can put your data validation logic in the
FamilyRecordclass itself. When you detect an error put theFamilyRecordinto an error state that will provide a visual cue in the grid.EDIT:
To determine, upon saving, whether any
FamilyRecordobjects in your collection have any errors you’d want something like this: