ScrollPattern.ScrollPatternInformation.VerticalScrollPercent Property

 

Gets the current vertical scroll position.

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

public double VerticalScrollPercent { get; }

Property Value

Type: System.Double

The vertical 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] =
        scrollPattern.Current.HorizontalScrollPercent;

    percentage[1] =
         scrollPattern.Current.VerticalScrollPercent;

    return percentage;
}

.NET Framework
Available since 3.0
Return to top
Show: