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

ScrollToHorizontalOffset() public méthode

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

Usage Example

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

            offset += viewer.HorizontalOffset;
            offset = Math.Max(Math.Min(offset, viewer.ExtentWidth), 0);
            viewer.ScrollToHorizontalOffset(offset);
        }
All Usage Examples Of System.Windows.Controls.ScrollViewer::ScrollToHorizontalOffset