I have a PasswordBox on a page which I am trying to set to automatically have focus when navigating to the page.
I am having problems where when I give it focus programmatically, it accepts the focus, but the keyboard goes away.
This causes a problem as the user must click off the PasswordBox, and then back on to use the control.
I have tried adding this code in the page's Loaded event, the ContentGrid.Loaded, OnNavigatedTo, and they all produce the same result.
I have tried setting the TabIndex/IsTabStop of the page, and the control itself, but it does not seem to work. The Passwordbox is the only item which has a TabIndex.
<PasswordBox x:Name="pwbAnswer" Style="{StaticResource PasswordBoxStyle}" VerticalAlignment="Top" Grid.Row="3"
PasswordChanged="pwbAnswer_PasswordChanged" KeyUp="pwbAnswer_KeyUp" TabIndex="1" IsTabStop="True" />
private void ContentGrid_Loaded(object sender, RoutedEventArgs e)
{
this.IsTabStop = true;
pwbAnswer.Focus();
}