I think there is no right way or wrong way. It all depends on your application and whether you use different templates or architectures or have specific needs for your WPF application.
If you use a different layered architecture, you can put your validation in the business layer of your application. In this case, use this link .
In my applications, I like to set validation in the viewmodel. Obviously, in some cases this is, for example, a bad idea; If you have the FirstName property in your view model, this means that you are only restricting the GUI for checking the FirstName property, but what if someone sets it from another location.
It all comes down to the needs of your application and requirements. Personally speaking, I put them in my ViewModel as quick and easy. But for best practice, I recommend you read the link.
I also recommend that you read the following links to give you a better understanding;
How to use model validation rules in WPF ViewModel
OR
Business Level Validation Example
Hope this helps!
source share