ScrollView that can always be scrolled

alxbogalxbog RUMember ✭✭

I have some controls wrapped by ScrollView. If controls are exceeding the parent view size the view is draggable (scrollable).

How to make the view always draggable even if if its content is not exceeding the parent view size? It's not about controls visibility, it's about UI feedback. So the view will behaves as table view on iOS (it's always draggable).

Answers

  • IanGeogheganIanGeoghegan USUniversity ✭✭
    edited July 2014

    I would love to know how to do this as well.

  • alxbogalxbog RUMember ✭✭

    Here is the solution for iOS using a custom renderer:

    public class BouncyScrollViewRenderer : ScrollViewRenderer
    {
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);
    
            if (e.OldElement == null)
            {
                var scrollViewModel = (ScrollView)Element;
                if (scrollViewModel.Orientation == ScrollOrientation.Vertical)
                {
                    AlwaysBounceVertical = true;
                }
                else if (scrollViewModel.Orientation == ScrollOrientation.Horizontal)
                {
                    AlwaysBounceHorizontal = true;
                }
            }
        }
    }
    
Sign In or Register to comment.