ListPicker inside ScrollViewer WP7 Toolkit Mango

Today I was going to add a ScrollViewer to my project, the problem is that inside the ScrollViewer control I had a ListPicker. Shouldn’t be a problem, right?

But unfortunatly that seems to be a known issue in the August release of the WP7 Toolkit. To resolve this I found a solution over att the Silverlight Toolkit website that seems to work. What you have to do is edit the source of the WP7 toolkit, more precisly the file ListPicker.cs. Here is how you do it:

On line 881, change the following:

if (IsValidManipulation(e.OriginalSource, e.ManipulationOrigin.X, e.ManipulationOrigin.Y)
     && 0 < Items.Count)
{
   if (Open())
   {
      e.Handled = true;
   }
}

To this:

Point point = new Point(e.ManipulationOrigin.X, e.ManipulationOrigin.Y);
if (e.ManipulationContainer != e.OriginalSource)
{
   var trans = e.ManipulationContainer.TransformToVisual((UIElement)e.OriginalSource);
   point = trans.Transform(point);
}
 
if (IsValidManipulation(e.OriginalSource, point.X, point.Y) && 0 < Items.Count)
{
   if (Open())
   {
      e.Handled = true;
   }
}

Credit for this goes to Drachen23 at CodePlex.

Source: http://silverlight.codeplex.com/workitem/9332

Note: The solution also mention, to handle the Tap event of the ListPicker does not seem to work, it correctly opens the ListPicker, but does not always react when user wants to close it in Expanded Mode.

No Comments Yet

You can be the first to comment!

Sorry, comments for this entry are closed at this time.