Alias Varghese
Alias Varghese

Reputation: 2172

win10 UWP OnScreen Keyboard is not hiding

I have created a Win 10 UWP application . in that I have a popup for which light dismissal is enabled.

<Popup x:Name="AddWebpagePopup" IsLightDismissEnabled="True" IsOpen="{Binding IsPopupOpen}" Opened="AddWebpagePopup_Opened">
    <TextBox x:Name="WebpageNameTextBox"  Text="{Binding WebpageUrl, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource TexBoxStyle}" KeyDown="WebpageNameTextBox_KeyDown" />`
  <Button Content="Cancel" Command="{Binding CancelCommand}" HorizontalContentAlignment="Center"/>
    </popup>

In AddWebpagePopup_Opened I am just setting the focus to WebpageNameTextBox. In CancelCommandI am just setting IsPopupOpen to False My issue is with OnScreenKeyBoard In tablet mode. Keyboard is showing properly when the popup is opened and closing when cancel button is clicked. Issue is there only when I touch outside the popup. Popup was dismissed but the keyboard was still visible. Anyone have idea why this happen?

Upvotes: 0

Views: 525

Answers (1)

Slupka
Slupka

Reputation: 121

When someone presses the "Cancel" button, the button gets focus -> the keyboard hides. It seems that the closing of popup is not enough to lose focus, so the keyboard is still visible.

You can try to change the focus when the popup is being closed. Although there is no closing event, you can register to property changed callback event.

this.AddWebpagePopup.RegisterPropertyChangedCallback(Popup.IsOpenProperty, (d, e) =>
{
    if (!this.popup.IsOpen)
    {
        // change focus to something else
    }
});

Upvotes: 1

Related Questions