WPF DataGrid validation error and editing

Neo 421 Reputation points
2022-12-23T06:49:49.797+00:00

273653-datagrid-error-state.png
I see that if there is validation error, DataGrid enters a special state - it won't allow any other editing until the error is corrected.
Now I have a problem. How can I tell if the DataGrid is in error state in code? In RowEndEditing event, I cannot tell if the edit commit is valid or not.

Developer technologies Windows Presentation Foundation
{count} votes

Accepted answer
  1. Hui Liu-MSFT 48,676 Reputation points Microsoft External Staff
    2022-12-26T08:27:17.55+00:00

    Hi,@Neo . For detecting Validation Errors, you could try to refer to the following code. You can also refer here for more solutions.
    274023-validation-state.txt

    The reuslt:
    274024-12.gif

    Hope my solution could help you.
    Best Regards,
    Hui

    ----------------------------------------------------------------------------

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.