Lose text box focus

In my Windows Phone 7 application, I wrote some code to go to the next text field on the pressed return key. This all works great, but now I want the software keyboard to be disabled if the user presses the back button in the final text field. However, there is no UnFocus () method. What should I do instead? :)

I thought that Focusing is something else (like PhoneApplicationPage), but it does not 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(); } } } 
+4
source share
1 answer

I always use this situation

 this.Focus() 
+13
source

Source: https://habr.com/ru/post/1385799/


All Articles