I have one textbox on a windows phone page and I want to show keyboard as soon as the page is loaded.
Is there any way to make this textbox already focused when I navigate to this page?
I considered using Guide.BeginShowKeyboardInput()
but I don't think it's a good solution in silverlight.
Override the OnNavigatedTo
method for the page.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Set focus to the TextBox, this will pop up the
// virtual keyboard
myTextBox.Focus();
}
Yeah, I wouldn't manually show the keyboard. It may be an annoyance for those that have devices with a physical keyboard. In the load event for the page you could just call the Focus method on the textbox that you want to be selected. The Keyboard should automatically show as necessary.
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
txtLongitude.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