Prevent Save when Validation Errors occur on WPF DataGrid

6.1k views Asked by At

Currently, I have a DataGrid which is bound to some data in my ViewModel. I have ValidationRules set up for the Rows, and the Columns. What I would like to do is prevent the user from saving the file if there are any Validation Errors. I am using the RelayCommands class to route the Open, Save, etc commands to my ViewModel.

2

There are 2 answers

1
biju On BEST ANSWER
0
jbe On

You might be interested in the BookLibrary sample application of the WPF Application Framework (WAF). It disables the Save button when a validation error is active (e.g. DataGrid).