locked
Combining Scrolling With Other Events RRS feed

  • Question

  • I have a Windows Phone app in which I have a ScrollViewer. The ScrollViewer contains several ItemsControls. Clicking or tapping various items in the ItemsControls trigger the events, which I handle (this sometimes involves rebinding the ItemsControls, but I can change that if needed). However, I also want to allow the user to scroll the ScrollViewer by using the common gesture of sliding their finger. However, I think that the other events being handled is preventing this from happening. What can I do to allow the user to scroll by dragging their finger? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    • Moved by Jamles Hez Monday, August 25, 2014 8:25 AM
    Saturday, August 23, 2014 5:46 PM

Answers

  • Hi Nathan,

    I would recommend you to go through the blog: Where did all my gestures go? , it explain clearly where your gesture goes, but currently there is no good solution for this situation.

    I move the question to Windows Phone forum for a better support.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Proposed as answer by Jamles Hez Wednesday, September 3, 2014 12:16 AM
    • Marked as answer by Jamles Hez Friday, September 5, 2014 9:34 AM
    Monday, August 25, 2014 8:24 AM

All replies

  • Hi Nathan,

    I would recommend you to go through the blog: Where did all my gestures go? , it explain clearly where your gesture goes, but currently there is no good solution for this situation.

    I move the question to Windows Phone forum for a better support.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Proposed as answer by Jamles Hez Wednesday, September 3, 2014 12:16 AM
    • Marked as answer by Jamles Hez Friday, September 5, 2014 9:34 AM
    Monday, August 25, 2014 8:24 AM
  • I have a ScrollViewer which contains ItemsControls. When the user taps one of the items in the ItemsControls, I want to handle the item's tap or click event, but if the user slides or drags their finger or cursor, I want to scroll the ScrollViewer. In a previous post about this at:

    http://social.msdn.microsoft.com/Forums/windowsapps/en-US/72761d59-e0ce-4a9b-99b0-d532896a0363/combining-scrolling-with-other-events?forum=wpdevelop

    And at the blog:

    http://blogs.msdn.com/b/wsdevsol/archive/2013/02/16/where-did-all-my-gestures-go.aspx

    I, if I understand correctly, I need to use manipulation events and manipulation modes to do this so that only the desired controls attempt to handle the events. Can anybody help me figure out exactly how to do this (assuming this is how it should be done)? Are there any good examples of how ScrollViewers and manipulation events & modes should be used together? My basic goal is to handle the tap event if the user lifts their finger, and scroll if the user slides their finger. Thanks.


    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Wednesday, September 10, 2014 4:54 PM
  • The page may helpful. http://stackoverflow.com/questions/12636216/scrollviewer-and-handling-manipulation-events-on-child-elements
    Monday, September 15, 2014 8:09 AM
  • Hi Nathan,

    The problem is that you can either have the system handle the gestures or you can handle them yourself. You cannot start handling it yourself and then later decide to hand it off to the system to continue.

    This means that you need to choose on the initial PointerPressed who should handle the event. You can't wait for a manipulation such as Tap.

    The easy way is to decide based on where the PointerPressed occurred: if it's on a button then cancel the system manipulations and handle it yourself; otherwise, ignore it and let the ScrollViewer handle it.

    That won't work if you want to be able to scroll from anywhere and differ just on gesture. For example, if you want two fingers to scroll and one finger to pan (this isn't recommended, but is a fairly frequent request). In this case you will need to handle both parts, including the scrolling, yourself.

    You can use the ScrollViewer's ChangeView(IReference(Double), IReference(Double), IReference(Single)) method to scroll based on your handling of the manipulation events.

    --Rob

    Monday, September 15, 2014 9:58 PM