0

Is there a way I can catch the flicked direction of the Panorama in WP8 by overriding its manipulation events.

I need to make a decision based on which direction it being swiped to.

Neil Turner
  • 2,712
  • 2
  • 18
  • 37
ashok
  • 187
  • 2
  • 11

1 Answers1

0

I dont know how to catch the flick but I know how to know if the user is sliding to right or to left. Maybe, this will fit your need.

We are going to use the event SelectionChanged. We have a list of PanoramaItem like this :

<phone:Panorama x:Name="SamplePanorama" SelectionChanged="SamplePanorama_SelectionChanged">

    <phone:PanoramaItem Header="Sample1" Tag="sample1" />

    <phone:PanoramaItem Header="Sample2" Tag="sample2" />

    <phone:PanoramaItem Header="Sample3" Tag="sample3" />

</phone:Panorama>

And in your C# :

private void Panorama_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{
    if (e.AddedItems.Count < 1) return;
    if (!(e.AddedItems[0] is PanoramaItem)) return;

    PanoramaItem selectedItem = e.AddedItems[0] as PanoramaItem;
    string tag = selectedItem.Tag.ToString();

    if (tag.Equals("sample2"))
        // user flick from right to left
    else if (tag.Equals("sample3"))
        // user flick from left to right
 }

more info here or here

Community
  • 1
  • 1
aloisdg
  • 22,270
  • 6
  • 85
  • 105
  • What you have said is correct. My requirement is to disable the circular navigation of the panorama which i feel can be done by handling that in its manipulation. Say if i am in first panorama item and i detect a left swipe, i just say e.complete and it will not navigate to the last panorama item. If you know any way of disabling circular navigation in panorama, do help me out. – ashok Jan 13 '15 at 11:48
  • This is another question. I dont think it is a good idea. You are breaking the UI. [Read this one](http://stackoverflow.com/a/11224605/1248177). – aloisdg Jan 13 '15 at 12:37
  • Agreed, don't try and change the expected behaviour of a `Panorama` or `Pivot` control – Neil Turner Jan 13 '15 at 14:52