Pinch
Pinch

Reputation: 2888

How to hide soft keyboard when listbox is scrolled?

In WP8, how to hide the soft keyboard when the listbox is scrolled?

Is there an event to detect when the listbox is scrolled?

Upvotes: 1

Views: 386

Answers (1)

DotNetRussell
DotNetRussell

Reputation: 9857

So I duplicated your problem in a Windows Phone 8 application.

I tested this solution and it does in fact work.

What you want to do is target the ListBox.ManipulationStarted event

Inside this event just simply do this.Focus();

This will cause the soft keyboard to retreat

Your final product might look like this

public page2()
{
    InitializeComponent();
    for (int x = 0; x < 100; x++)
    {
        lb.Items.Add(x);

    }
    lb.ManipulationStarted += lb_ManipulationStarted;
}

void lb_ManipulationStarted(object sender, System.Windows.Input.ManipulationStartedEventArgs e)
{
    this.Focus();
}

So my round about way of answering your question is no, there is no scroll event for the listbox. Anything you do will be a hack similar to this but it DOES work.

Upvotes: 2

Related Questions