Select XAML TextBox in StackPanel using TextBox's Index
问题 I have the following code: //All elements edited below have already been defined in MainPage.xaml int index = Window_1_Document_Page_1.Children.IndexOf(sender as TextBox); //Window_1_Document_Page_1.Focus(FocusState.Programmatic); Window_1_Document_Page_1.Children.Remove(sender as TextBox); Before deleting sender as TextBox , how do I set the focus to the TextBox above it? Thanks in advance. 回答1: Maybe there is a more elegant solution, but this should work: //Get index of control you want to