I have a big WPF project with a lot of input validation, I do not want to use the inbuild attribute validation anymore as it often leads to issues with when the data validation is triggered.
I would however like to just be able to manually handle errors, and still use the GUI I am given to display errors.
All presentation objects have IDataErrorInfo
So is it possible to manually set the error text and handle when it is shown or not.
Example
So when I press Save on my View something like this would happen
private void Validate()
{
bool success = true;
If(a == null)
{
a.ValidationError = true;
a.ValidationText = "A is required!"
success = false;
}
else
{
a.ValidationError = false;
}
return success;
}
So if A is null, an error is marked and the tooltip shows my "A is required!" text
Is it possible to control it completely manually and just loop through my data at specified times and show errors.
Aucun commentaire:
Enregistrer un commentaire