Keyboard won't dismiss even after Focus change

后端 未结 5 1910
忘掉有多难
忘掉有多难 2020-12-19 06:05

I am creating a Windows 8.1 app and after the user presses a button, a popup opens over most of the screen. There are several textboxes inside the popover.

I found

5条回答
  •  长情又很酷
    2020-12-19 06:36

    In my app this works fine:

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        this.KeyDown += Strona_KeyDown;
    }
    
    private void Strona_KeyDown(object sender, KeyRoutedEventArgs e)
    {
        if (e.Key == Windows.System.VirtualKey.Enter)
        {
            this.Focus(FocusState.Pointer);
        }
    }
    

提交回复
热议问题