In my WindowsPhone application I have a Text Box that needs to receive focus at a given time. What I’ve tried so far:
textBox1.Focus();
textBox1.UpdateLayout();
textBox1.Focus();
textBox1.IsTabStop = true;
textBox1.UpdateLayout();
textBox1.Focus();
textBox1.IsTabStop = true;
textBox1.Focus();
Nothing seems to work. In the Emulator, when the Focus() method is called, the keyboard starts to rise, but then crashes back. The TextBox has IsTabStop set to true in the properties.
This seems to be a Silverlight bug. I’ve used the
TextChangedevent on theTextBox, and set theFocus()in there. Kind of an ugly workaround, but it worked for me. If anybody has another solution, please post.