Forum Xamarin.Forms

Disable scrolling in ScrollView

PhilippSumiPhilippSumi USMember ✭✭✭
edited January 2017 in Xamarin.Forms

Summary

This forum has a lot of threads of people running into issues because you cannot nest ScrollViews. One of them is a ScrollView for the content, and some fixed input controls. Think about any chat application, for example.

Now, we run into problems becuase the keyboard now doesn't act nicely, especially on iOS. I think the solution would be to just be able to programmatically disable scrolling on a ScrollView. Like that, we could have someting like this:

OuterScrollView
{
    InnerScrollView
    {
        MessageList
    }
    Editor
}

The scrolling on the outer scrollview would be disabled by default. Like that, the user would just scroll the chat messages in the InnerScrollView.

If the user clicks the Editor, scrolling on the InnerScrollView would be disabled, and scrolling on the OuterScrollView enabled. This would enable the keyboard to just move up all the content. That might solve a lot of nested ScrollView scenarios - because in all of them, you'd want one particular view to scroll. Question is whether that can be easily done or not (my feeling would be YES if done in the actual control - it's just not listening to the swipe gestures I assume).

API Changes

Add _IsScrollingEnabled _property to ScrollView, to programmatically enable/disabled scrolling depending on state determined by presentation logic.

Intended Use Case

  • Disabling scrolling in scenarios such as Drag and Drop.
  • Switch scrolling between inner/outer containers depending on application state (e.g. scroll chat list vs scroll the whole view when keyboard shows)
Tagged:

Open · Last Updated

Posts

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭
    1. Please format posts in this section per the guideline given.
    2. If you're not going to scroll a scrollview - use another container. What would be the purpose or advantage you see in using a scrollview that can't scroll?
  • PhilippSumiPhilippSumi USMember ✭✭✭

    @ClintStLaurent said:
    1. Please format posts in this section per the guideline given.
    2. If you're not going to scroll a scrollview - use another container. What would be the purpose or advantage you see in using a scrollview that can't scroll?

    1. Done.
    2. See Use cases.
Sign In or Register to comment.