I have a WPF DataGrid with RowValidationRules. I would like to set the focus or begin editing a specific cell in case a validation fails.
For example, if the value in a cell has be lower than the value in another cell and the user does not respect this rule, I would like to automatically set the focus and begin editing the first cell.
What is the most elegant way to do this? I noticed that the ValidationResult.ErrorContent property is usually used to display an error message, but since it is of type "object", maybe I could customize it to return information about the cell that should get the focus in case of a validation error? I'm not sure how to recover and use that information in XAML though.