ScrollPattern.ScrollPatternInformation.HorizontalScrollPercent Property


Gets the current horizontal scroll position.

Namespace:   System.Windows.Automation
Assembly:  UIAutomationClient (in UIAutomationClient.dll)

public double HorizontalScrollPercent { get; }

Property Value

Type: System.Double

The horizontal scroll position as a percentage of the total content area within the UI Automation element. The default value is 0.0.

In the following example, a ScrollPattern object obtained from a target control is passed into a function that retrieves the current horizontal and vertical scroll percentages of the viewable region within the content area.

/// <summary>
/// Obtains the current scroll positions of the viewable region 
/// within the content area.
/// </summary>
/// <param name="scrollPattern">
/// The ScrollPattern control pattern obtained from the 
/// element of interest.
/// </param>
/// <returns>
/// The horizontal and vertical scroll percentages.
/// </returns>
private double[] GetScrollPercentagesFromPattern(
    ScrollPattern scrollPattern)
    if (scrollPattern == null)
        throw new ArgumentNullException(
            "ScrollPattern argument cannot be null.");

    double[] percentage = new double[2];

    percentage[0] =

    percentage[1] =

    return percentage;

.NET Framework
Available since 3.0
Return to top