Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am very desperately needed solution to below problem.If you know please let me know.

I have WPF web browser project.On Page1.xaml I have wpf usercontrol usrcntl1. This usrcntl1 is having three textboxes txtBox1,txtBox2,txtBox3.

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 will want to set focus on txtBox1.

I am not able to set the focus on usercontrol's textbox. if you have any solution please let me know.
update patquotdet set qdindtslno=1 where qdpnarefno='800016692'
and qdpnaslno=3
thanks
Bkhan.
Posted
Updated 13-Jan-14 8:05am
v2

1 solution

There is no such thing as "cursor focus". All focus activity is about the keyboard focus, nothing else.

WPF has a dedicated system pertaining to focus you should learn: http://msdn.microsoft.com/en-us/library/aa969768.aspx[^].

Nevertheless, in many case, the simplest thing works: call Control.Focus, in particular, TextBox.Focus. See:
http://msdn.microsoft.com/en-us/library/system.windows.controls.control.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.uielement.focus.aspx[^].

—SA
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900