I have a RadGridView with ItemsSource bound to a collection of business objects. The grid has a GridViewDataColumn bound to a property with a TwoWay binding. The property has a validation attribute.
When the user is editing the cell, and presses <Enter>, the validation attribute's IsValid() method is invoked, and if validation succeeds, the griid navigates to the same column in the next row. But if validation fails, the failure is visualized and the navigation does not occur. In fact, any attempt to navigate away from the cell by any means causes validation, and if the validation fails, the navigation does not occur. This is all good, and exactly as it should be. Anything less would be wrong -- what's the point of validation if it doesn't force the user to enter valid data?
But here's my problem. I also want the down and up arrows to navigate up and down while editing. Seems as if it should be straight forward -- just preview KeyDown, handle up and down keys and execute the grid's MoveUp and MoveDown commands, right? Wrong. When the grid's MoveUp or MoveDown command is executed, the validation attribute's IsValid() method is still invoked, but a failed validation does not prevent the navigation.
This seems like such a routine requirement that I feel like I must be missing something. The reason for the existence of the MoveUp, MoveDown, etc., commands seems to be the recognition that navigation controls might need to be more robust that the default behaviors. But those command circumventing validation appears to make them useless. Surely I'm just missing something.