Nested ScrollView problem.

I’m using nested scrollviews. Is it possible to detect and scroll only the inner scrollview?

The system does it automatically but once the inner scroll hits its limit, it automatically starts to scroll the outer one which is a bit frustrating when dealing with small inner scrolls;

I know how to get the element, but disabling the scroll itself seems to be a problem;

I tried:
ScrollView.showVertical = false;
ScrollView.verticalScroller.SetEnabled (false);

None of which disables the scroll. Ideally it would only stop the scrolling, but keep drawing it, but if this isn’t a possibility it’s fine;

I imagine that a possible workaround would be to keep track of the outer scroll position and if scrolling from the inner ones setting the outer scroll back. I didn’t try it yet on the hopes that you guys have a better solution;

1 Like

Hey @Knosis_Co-Verse :slight_smile:

Two little questions :

  1. Have you solved your (mouse) scrolling issue with nested ScrollViews ?
  2. Have you tried to use nested ScrollViews on mobile ?
    (I am looking for people who have tried to use them on mobile)
1 Like

Sorry for not answering this earlier.

I think the most straightforward way to achieve this is to block the wheel events on the inner scrollview:

scrollview.RegisterCallback<WheelEvent>(OnScrollWheel);

private void OnScrollWheel(WheelEvent evt)
{
   evt.StopPropagation();
}

This would prevent the event from getting to the parent scroll view (while still allowing the scroll view itself to scroll).

1 Like