kadben
kadben

Reputation: 185

Hide WinRT virtual keyboard when scrolling

I have a textbox in scrollviewer, I want to hide the virtual keyboard when I scroll.

the keyboard is hidden when the scrollviewer is tapped but not when I scroll.

I tried to change focus to another element in the viewchanged event of the scrollviewer but not working.

Upvotes: 1

Views: 112

Answers (1)

Damien
Damien

Reputation: 2901

When the textbox that showed the virtual keyboard has property IsEnabled set to false, the virtual keyboard disappears. We can immediately set is to true after that and the virtual keyboard will remain hidden. Here is how to do it:

searchTextBox.KeyDown += (s, a) => {
    if (a.Key == VirtualKey.Enter) {
        searchTextBox.IsEnabled = false;
        searchTextBox.IsEnabled = true;

    }
};

Upvotes: 1

Related Questions