0

I know that this is not a good practice, but I would like to simulate a mouse click event on a textbox, or a window in my wpf application.

I need this, because I am calling this application with some kind of interceptor and the window doesn't get the full focus, it is in front, textbox has a focus but u can't directlly type on textbox.

on window load I call these methods

this.Activate();
this.Topmost = true;
TextBox1.Focus();
Keyboard.Focus(TextBox1);

Thank you.

Sandi Horvat
  • 407
  • 1
  • 6
  • 17
  • Here the solution for your question: http://stackoverflow.com/questions/1874394/capture-mouse-clicks-on-wpf-textbox – Mr.B Sep 15 '16 at 12:43

1 Answers1

2

I had the same issue in VB. i just wanted the focus in the SpinEdit1 (or any control) when the form load. Here is:

private void formX_Load(object sender, EventArgs e)
{
    this.ActiveControl = SpinEdit1;
}
Smittey
  • 2,475
  • 10
  • 28
  • 35
Juanche
  • 104
  • 2
  • 8