In my Windows Phone 7 Application I've written a bit of code to make the focus jump to the next textbox on the return key bein pressed. This all works fine, but now what I want to do is get the software keyboard out of the way if the user pressed return on the final textbox. However there is no UnFocus() method. What should I do instead? :)
I thought about Focusing something else (e.g. The PhoneApplicationPage) but this doesnt have a Focus() method.
public List<TextBox> Textboxes = new List<TextBox> { };
public void CheckForReturn(object sender, KeyEventArgs e)
{
TextBox ThisTextbox = sender as TextBox;
if (e.Key == Key.Enter)
{
int ThisTextboxListPosition = Textboxes.IndexOf(ThisTextbox);
int NextTextboxListPosition = ThisTextboxListPosition + 1;
if (NextTextboxListPosition < Textboxes.Count)
{
TextBox NextTextBox = Textboxes[NextTextboxListPosition];
NextTextBox.Focus();
}
else
{
//Something like this!
//ThisTextbox.Unfocus();
}
}
}
I am always use in this situation
this.Focus()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With