Hi,
I'm a complete beginner at WPF.
I've made a usercontrol "labeledTextbox" that holds a label, a textbox and a textblock for errormessages.
When the user hits the submit button, I call SomeValidationMethod() to validate the user input. When one of the textboxes contain invalid data, I pass the errormessage to the corresponding usercontrol which in his turn shows it to the user.
I come from the webworld where the page gets refreshed every postback which means you only have to worry about setting the errormessages when an error occured. But in WPF, you also have to clear the errormessages when the error was corrected.
I'm looking for a way in WPF to somehow clear all errormessages on the page. Then I can call SomeClearAllErrorsMethod() at the top of my SomeValidationMethod().
So I guess I need the following:
- A way to get the collection of labeledTextbox usercontrols on the page
- A way to iterate the collection so I can set the ErrorMessage property to null for each labeledTextbox usercontrol
But, I'm also wondering if there is a more elegant, best-practice way of doing what I'm trying to accomplish.
Thanks for all info