Esempio n. 1
0
        void UpdateScrollPosition()
        {
            if (ScrollView == null)
            {
                return;
            }

            var height = ScrollView.Height;
            var contentHeightOverflow = ScrollView.ContentSize.Height - height;

            if (contentHeightOverflow >= 0)
            {
                if (height >= 0)
                {
                    var location = ContentView.DocumentVisibleRect().Location;
                    if (location.Y > -1)
                    {
                        ScrollView.SetScrolledPosition(Math.Max(0, location.X), Math.Max(0, contentHeightOverflow - location.Y));
                    }
                }
            }
            else
            {
                ResetNativeNonScroll();
            }
        }
        private bool ResetNativeNonScroll( )
        {
            if (ScrollView == null || ContentView == null)
            {
                return(false);
            }

            if (ScrollView.ScrollY <= 0.0f && ContentView.DocumentVisibleRect().Location.Y > 0.0f)
            {
                ContentView.ScrollToPoint(new CoreGraphics.CGPoint(0, 0));
                return(true);
            }

            return(false);
        }
        void UpdateScrollPosition()
        {
            if (ScrollView == null)
            {
                return;
            }

            if (ScrollView.ContentSize.Height >= ScrollView.Height)
            {
                CoreGraphics.CGPoint location = ContentView.DocumentVisibleRect().Location;

                if (location.Y > -1)
                {
                    ScrollView.SetScrolledPosition(Math.Max(0, location.X), Math.Max(0, ContentView.Frame.Height - location.Y));
                }
            }
            else
            {
                ResetNativeNonScroll();
            }
        }