Click here to Skip to main content
14,304,321 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am very desperately needed solution to below problem.If you know please let me know.

I have WPF usercontrol project. On Page1.xaml I have wpf usercontrol ucGrid1. This ucGrid1 is having no. of textboxes txtBox1,txtBox2,txtBox3 etc.

As per business logic once user entered values in user control's textboxes (on Page1.xaml), i will validate txtBox1,txtBox2,txtBox3 values. if any wrong value entered i need to set the focus on txtBox1.

I am not able to set the focus on usercontrol's textbox. if you have any solution please let me know.

Sripriya B,
Amir Mahfoozi 14-Jul-12 2:43am
Please provide the code that validates inputs and take the focus on invalid text box.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1


When you are binding the variables with the textboxes at that time you could mention rule and logic to check for the base validation as explained in link bellow:


Rather then checking it once all of the textbox entries are done, it's better to validate just while entering Data.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100