Validating data in wpf Chat for free and direct sexual
I mentioned previously that checks the validation after the property has been updated.This means if we attempt to insert a non-integer field with a non-integer value, the validity checking never occurs: instead, WPF swallows the error.
In other words, this approach lets me put bad data in that I must then take out.
Creating Custom Validation Rules Wouldn’t it be better to have a reusable piece of code to handle these similar situations? is an abstract class that we can inherit from to create a custom validation rule class of our own.
I could certainly create a custom rule class for each property in my DAL, and perhaps sometimes a custom class for a particular field would make sense, but many times all I need is a generalized validation rule.
Using a validation rule causes the validation to occur before the property is updated, so we can easily prevent such an occurrence and report it to the user.
It does still allow the bad data into the Text Box, but that’s not necessarily a bad thing.
The Code Project article even links to a Project with a WPF version of Error Provider.