locked
Prevent scrolling of outer container when inner container is scrolled to the end

    Question

  • Hello,

    In a setup where one horizontally scrollable element is contained in another horizontally scrollable element (e.g. some kind of a panel in a GridView), the following happens by default: when user taps and drags within the inner element, once it's been scrolled to the end the outer element starts scrolling.

    I am looking for some way to prevent this "secondary" scrolling from happening, so that once the inner element has scrolled to the limit, no further scrolling would occur anywhere.

    Any suggestions would be appreciated.

    Alex

    Wednesday, May 21, 2014 11:40 AM

Answers

  • Did you try setting the Scrollviewer.IsHorizontalScrollChainingEnabled="False"? You can set this property in the gridview's xaml.

    Are you are trying to prevent a flipview from flipping? I hope someone can tell you how because as far as I can tell, flipviews want to flip. It's in their nature to flip. There's a few workarounds if you want to prevent the flipview from flipping.

    1. Replace flipview with ListView and replace your flip view items with list view items. Set snap points to your items so it works very similar to a flipview except for a few nice-to-haves like mouse over buttons, etc. Disable horizontal scroll chaining and disable horizontal scrolling when you don't want to turn the page. You can also handle the routed event you are looking for in this scenerio.

    2. remove items from your flipview at runtime when you don't want to flip. The flipview will not flip if there is no content in the other index. Suppose you want to disable flipping to the right, then remove the flip view items from the index to the right. When you want to re-enable flipping then populate the index again. 

    Both of the solutions have plenty of drawbacks and depending on your needs neither may work for you. If that's the case, I hope an flipview expert can show a way to stop a flipview from flipping. 


    • Edited by Bryan Stump Wednesday, May 28, 2014 1:21 PM
    • Proposed as answer by Bryan Stump Thursday, May 29, 2014 4:13 AM
    • Marked as answer by KHK Software Thursday, May 29, 2014 11:48 AM
    Wednesday, May 28, 2014 1:17 PM

All replies

  • Hi,

    Would you mind sharing your project to skyDrive and share a link in the forum.

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; 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.

    Thursday, May 22, 2014 2:21 AM
  • Here is the link.

    It illustrates my question by having a set of horizontally scrollable GridViews in a FlipView.

    Once again, what I am trying to achieve is the scenario when a user scrolls the GridView content, but when the right/left limit is reached the FlipView does NOT switch to the next page.

    Friday, May 23, 2014 3:52 PM
  • Hi,

    I test your project. And you cannot control it. Because this is by design. When you scroll the GridView Content to the right limit and then scroll it, the scrollviewer control in GridView cannot response the scroll gesture, so the FlipView response to it. This is routed events, which is an event that is potentially passed on (routed) from a child object to each of its successive parent objects in an object tree.You can refer to the link to get more information:

    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh758286.aspx

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; 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.

    Wednesday, May 28, 2014 3:29 AM
  • I know what RoutedEvents are and how they work.

    What I was looking for is to find out which scrolling event on the inner control (the GridView in the example) I can subscribe to in order to call the base class's event and then set e.Handled = true to prevent the event propagating from further (i.e. to the FlipView).

    Wednesday, May 28, 2014 12:01 PM
  • Did you try setting the Scrollviewer.IsHorizontalScrollChainingEnabled="False"? You can set this property in the gridview's xaml.

    Are you are trying to prevent a flipview from flipping? I hope someone can tell you how because as far as I can tell, flipviews want to flip. It's in their nature to flip. There's a few workarounds if you want to prevent the flipview from flipping.

    1. Replace flipview with ListView and replace your flip view items with list view items. Set snap points to your items so it works very similar to a flipview except for a few nice-to-haves like mouse over buttons, etc. Disable horizontal scroll chaining and disable horizontal scrolling when you don't want to turn the page. You can also handle the routed event you are looking for in this scenerio.

    2. remove items from your flipview at runtime when you don't want to flip. The flipview will not flip if there is no content in the other index. Suppose you want to disable flipping to the right, then remove the flip view items from the index to the right. When you want to re-enable flipping then populate the index again. 

    Both of the solutions have plenty of drawbacks and depending on your needs neither may work for you. If that's the case, I hope an flipview expert can show a way to stop a flipview from flipping. 


    • Edited by Bryan Stump Wednesday, May 28, 2014 1:21 PM
    • Proposed as answer by Bryan Stump Thursday, May 29, 2014 4:13 AM
    • Marked as answer by KHK Software Thursday, May 29, 2014 11:48 AM
    Wednesday, May 28, 2014 1:17 PM
  • Thank you, Bryan, Scrollviewer.IsHorizontalScrollChainingEnabled="False" turned out to be exactly what I needed.

    And no, I am not trying to prevent a FlipView from flipping - only to prevent the nested GridView from flipping the outer FlipView :-)

    • Proposed as answer by Bryan Stump Thursday, May 29, 2014 4:12 AM
    • Unproposed as answer by Bryan Stump Thursday, May 29, 2014 4:13 AM
    Wednesday, May 28, 2014 1:28 PM