I have a WPF page (as my View) in an MVVM model. The View is an entry form with many textboxes. I have a custom ValidationRule built to validate each textbox and display tooltip warnings accordingly. However, I only want the “Commit” button to be enabled when all the validators pass. Right now, my “Commit” button’s IsEnabled is bound to the DataContext based on other criteria. How do I add the caveat of “only be enabled when all validators pass” when my IsEnabled is already bound like so?
IsEnabled="{Binding IsDataLoaded}"
Your Commit button should be bound to a
RelayCommandin yourViewModel, and just set theCanExecute()to only be true ifthis.IsDataLoadedandthis.IsValidFor verifying if the ViewModel is valid or not, I would suggest using IDataErrorInfo