I have an user control with Focusable=true and IsTabStop=true.
I can focus it using Tab key. but I need to focus it from code.
I tried uc.Focus() and Keyboard.Focus(uc) but it doesn’t work.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Tejas is probably correct. If WPF is doing some rendering/layout update, you want to postpone the .Focus() task a little and not get in WPF’s way. Try this: