System.Windows.Controls.ScrollViewer.SetScrollOffset C# (CSharp) Method

SetScrollOffset() public method

public SetScrollOffset ( Orientation orientation, double value ) : void
orientation Orientation
value double
return void
        void SetScrollOffset (Orientation orientation, double value)
        {
            if (ScrollInfo != null) {
                double scrollable = (orientation == Orientation.Horizontal) ? ScrollableWidth : ScrollableHeight;
                double clamped = Math.Max (value, 0);

                clamped = Math.Min (scrollable, clamped);

                // Update ScrollContentPresenter 
                if (orientation == Orientation.Horizontal)
                    ScrollInfo.SetHorizontalOffset (clamped);
                else
                    ScrollInfo.SetVerticalOffset (clamped);

                UpdateScrollBar (orientation, clamped);
            }
        }