System.Windows.Controls.ScrollViewer.ScrollToVerticalOffset C# (CSharp) Méthode

ScrollToVerticalOffset() public méthode

Scrolls the content within the ScrollViewer to the specified vertical offset position.
public ScrollToVerticalOffset ( double offset ) : void
offset double The position that the content scrolls to.
Résultat void
        public void ScrollToVerticalOffset(double offset)
        {
            SetScrollOffset (Orientation.Vertical, offset);
        }
 

Usage Example

        /// <summary>
        /// Scroll a ScrollViewer vertically by a given offset.
        /// </summary>
        /// <param name="viewer">The ScrollViewer.</param>
        /// <param name="offset">The vertical offset to scroll.</param>
        private static void ScrollByVerticalOffset(ScrollViewer viewer, double offset)
        {
            Debug.Assert(viewer != null, "viewer should not be null!");

            offset += viewer.VerticalOffset;
            offset  = Math.Max(Math.Min(offset, viewer.ExtentHeight), 0);
            viewer.ScrollToVerticalOffset(offset);
        }
All Usage Examples Of System.Windows.Controls.ScrollViewer::ScrollToVerticalOffset