Here is a bare-bones program that demonstrates the issue, except that the soft keyboard doesn't "show then hide" (like my real app), it just never shows up at all. The main window has the Username and Password fields to demonstrate that the keyboard works with TextBoxes in a main window. Display the same two fields (I copy/pasted the XAML) and the keyboard never shows up at all.
The XAML:
<Window x:Class="WpfKeyboardTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfKeyboardTest"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" FontSize="20">
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,20">
<Label Content="First Name:" Margin="0,0,10,0"/>
<TextBox Text="" TextWrapping="Wrap" Width="250" />
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Label Content="Last Name:" Margin="0,0,10,0"/>
<TextBox Text="" TextWrapping="Wrap" Width="250" />
</StackPanel>
<Button Grid.Row="2" Content="Show Popup" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,20,0,0" Padding="5" Click="onClick" />
<Popup x:Name="TestPop" Placement="Center" >
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" Background="White" Margin="3">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10">
<Label Content="First Name:" Margin="0,0,10,0"/>
<TextBox Text="" TextWrapping="Wrap" Width="250" />
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10">
<Label Content="Last Name:" Margin="0,0,10,0"/>
<TextBox Text="" TextWrapping="Wrap" Width="250" />
</StackPanel>
<Button Grid.Row="2" Content="Hide Popup" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="20" Padding="5" Click="onSubmit"/>
</Grid>
</Popup>
</Grid>
</Window>
And here is the code behind that simply shows/hides the popup window:
using System.Windows;
namespace WpfKeyboardTest
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void onClick(object sender, RoutedEventArgs e)
{
TestPop.IsOpen = true;
}
private void onSubmit(object sender, RoutedEventArgs e)
{
TestPop.IsOpen = false;
}
}
}