ChummyChum
Member
- Joined
- Sep 28, 2022
- Messages
- 10
- Programming Experience
- 1-3
Data validation in WPF seems too complicated, I am slowly getting the hang of it, but still need some help from you guys when using INotifyDataErrorInfo.
So, my problem is that I don't want my validation occur on property change, that is why I've set it up that all my property checks are done when a user clicks 'Save' button.
When the button is clicked I check all my properties and do 'AddError()' if something is not right. It works, the screen lights up in red, error messages appear etc.
BUT I am stuck on how to raise ErrorChanged for all of the properties when I clear it.
So when a user clicks 'Save' button again I want to clear all of the errors dictionary.clear() and then raise the errorschanged event BUT for all of the properties.
In all of the tutorials about INotifyDataErrorInfo there is:
and I get that but I want to raise Errors changed for the whole form, dont want to raise individually.
Is something like that possible? Personally I am a fan of form validation on user click and not on property changed.
I hope I described my ask clearly
So, my problem is that I don't want my validation occur on property change, that is why I've set it up that all my property checks are done when a user clicks 'Save' button.
When the button is clicked I check all my properties and do 'AddError()' if something is not right. It works, the screen lights up in red, error messages appear etc.
BUT I am stuck on how to raise ErrorChanged for all of the properties when I clear it.
So when a user clicks 'Save' button again I want to clear all of the errors dictionary.clear() and then raise the errorschanged event BUT for all of the properties.
In all of the tutorials about INotifyDataErrorInfo there is:
C#:
ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(propertyName));
Is something like that possible? Personally I am a fan of form validation on user click and not on property changed.
I hope I described my ask clearly