locked
what event fires when user lifts finger from scrollviewer

    Question

  • I have Stackpanel Inside Scrollviewer.I used Viewchanged event to apply some logic when user zoom it, but Viewchanged event fires as soon as there will be changes in a scrollviewer instead i want to apply my logic when user lifts fingers from scrollviewer so is there any event available for that? 
    Monday, April 21, 2014 7:08 AM

Answers

  • There are a few events on ScrollViewer which might work, PointerReleased might be a good one.  If none of them seem to be great for you, you might consider writing your own handler using manipulation events.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, April 21, 2014 7:10 PM
    Moderator
  • There isn't a direct event for this. The ScrollViewer doesn't pass its manipulation or pointer events on. If you need to handle them you'll need to take over the manipulations from the start. I discussed this a while back in my blog entry Where did all my gestures go?

    Other than that you can look for secondary effects like the ViewChanged event, but there isn't a done-changing event like you're asking for. You might be able to approximate it by tracking ViewChanged and waiting until they stop coming and now pointers are down.

    --Rob

    Tuesday, April 22, 2014 5:50 AM
    Owner

All replies

  • There are a few events on ScrollViewer which might work, PointerReleased might be a good one.  If none of them seem to be great for you, you might consider writing your own handler using manipulation events.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, April 21, 2014 7:10 PM
    Moderator
  • Hi Matt,

    Thanks for your reply.

    1. We have used "pointerrealeased" but that dont fire when we pinch on the scrollview.

    2. Have tried "Manipulation" events (on StackPanel), and it solves my problem to some extent (as now I have to manually set the SCALE to STACKPANEL) but in that case then we have to handle the IMAGE BOUNDING by ourselves (Is there any way to handle this in the default way as SCROLLVIEW does?). 

    Basically I was trying to build a simple image gallery app where user can SWIPE through the available images and can PINCH on any of these images to have a closer look at them.

    Currently what I have done is, 
     
     <FlipView x:Name="SampleFlip" >
             <FlipView.ItemTemplate>
               <DataTemplate>
                 <ScrollViewer  ViewChanged="testviewchanged" >
                   <StackPanel>
                <Image x:Name="image1" Source="{Binding image1}" />
                   </StackPanel>
                  </ScrollViewer>
                  </DataTemplate>
                </FlipView.ItemTemplate
     </FlipView>


    Its working as I want it to (using the ScrollView events, and it internally take cares of the IMAGE BOUNDING) but now the problem here is I want to track the "PINCH COMPLETE" event of the user. I have used the "ViewChanged" event of "ScrollViewer" assuming that it will solve my problem. 

    But found that its firing for every small change in the SCALE during PINCH event.
    Tuesday, April 22, 2014 5:33 AM
  • There isn't a direct event for this. The ScrollViewer doesn't pass its manipulation or pointer events on. If you need to handle them you'll need to take over the manipulations from the start. I discussed this a while back in my blog entry Where did all my gestures go?

    Other than that you can look for secondary effects like the ViewChanged event, but there isn't a done-changing event like you're asking for. You might be able to approximate it by tracking ViewChanged and waiting until they stop coming and now pointers are down.

    --Rob

    Tuesday, April 22, 2014 5:50 AM
    Owner