1
Answer

How to set focus in textbox inside wpf user control?

Sumit Kumawat

Sumit Kumawat

11y
3.9k
1

Hi all,

I am using two textbox control and two checkbox control named as  textbox1 , textbox2,checkbox1 and checkbox2. Actually what i want to give functionality in my code, when i checked Checkbox1 then my texbox1 should get focus.and same for another  checkbox2. i am using below code for  checkebox on checked event :

                    DispatcherPriority.ContextIdle,

                  new Action(delegate()
                  {

                      textbox1 .Focus();

                  }));

if i checked individually then it works fine but after got focus on textbox1. if i checked checkbox2 my textbox2 is not going to focus(viceversa).

Please help me 

Thanks

Answers (1)