Question How do I validate text fields in WPF?

stremblay

New member
Joined
Feb 19, 2009
Messages
1
Programming Experience
1-3
Hello all,

I have a very simple form that is being used as a registration form in a touch screen application. I have the following fields: txtFirstname, txtLastname, txtEmail, txtZip, and chkTerms. I need to make sure that these fields are not blank before allowing the user to continue. I have a button that they would press to continue. At that time, the data is written to the database. How can I make sure these fields are not blank before they continue? (chkTerms is a checkbox for terms and conditions) I've looked into the validation class in WPF, but I don't quite understand it as all the examples I've seen are written in C#.

Another problem I see with the built in validation class is that since this is a touch screen without a mouse, the user won't be able to hover over the textfield to see the error so I'm thinking I just want to make the label for each field turn red using something like this: lblFirstname.Foreground = brushes.red or something along those lines. Also, if possible, I would like to have the continue button stay disabled until all the fields (or at least the checkbox is checked) are filled out. Is this possible?

Thanks for any help you can give me. I should probably point out that this is my first WPF application so please be nice :)

Steve
 
Top Bottom