Rico Suter's blog.
 

I recently discovered a bug in the ListBox control for Windows Phone 7.5. In a long list of items (virtualizing list, items with different heights), the list sometimes begins to get jumpy and the list cannot be scrolled to the end. To reproduce the problem, open a long list of items, scroll a little bit, stop the scrolling and tap on an item. Now if you start scrolling again the list begins to get jumpy…

This video shows the problem:

After trying out a lot of possible workarounds and tweaks, I finally found the solution: Simply set the focus to another control if the ListBox’s ManipulationCompleted event has occured. I’ve extended my own ListBox implementation, ExtendedListBox from MyToolkit, with the following method.

protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
{
    var page = (PhoneApplicationPage)((PhoneApplicationFrame)Application.Current.RootVisual).Content;
    page.Focus();

    base.OnManipulationCompleted(e);
}

The method above will set the focus to the current page and the ListBox will immediately lose focus.(If you encounter problems with this workaround in the ExtendedListBox control you can “turn it off” by setting the UseScrollFix property to false). If you don’t want to create a new class which inherits from ListBox you can simply listen for the ManipulationCompleted event and set the focus to the current page:

<ListBox x:Name="listBox" ManipulationCompleted="OnManipulationCompleted" />

The OnManipulationCompleted callback:

private void OnManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
{
    this.Focus(); // set focus to current page
}

I think this is a bug in the ListBox implementation which can only be solved by Microsoft. More references:

WPCentral for the hint to use OnManipulationCompleted instead of OnGotFocus.



Discussion