ScrollPattern.NoScroll Field

 

Specifies that scrolling should not be performed.

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

public const double NoScroll

Field Value

Type: System.Double

This identifier is used by UI Automation client applications. UI Automation providers should use the equivalent field in ScrollPatternIdentifiers.

The value -1 can be substituted for the NoScroll field.

In the following example, a ScrollPatterncontrol pattern is obtained from an AutomationElement and is then used to scroll the viewable region to the top of the content area.

///--------------------------------------------------------------------
/// <summary>
/// Obtains a ScrollPattern control pattern from an automation 
/// element and attempts to scroll to the top of the
/// viewfinder.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
///--------------------------------------------------------------------
private void ScrollToTop(AutomationElement targetControl)
{
    if (targetControl == null)
    {
        throw new ArgumentNullException(
            "AutomationElement argument cannot be null.");
    }

    ScrollPattern scrollPattern = GetScrollPattern(targetControl);

    try
    {
        scrollPattern.SetScrollPercent(ScrollPattern.NoScroll, 0);
    }
    catch (InvalidOperationException)
    {
        // Control not able to scroll in the direction requested;
        // when scrollable property of that direction is False
        // TO DO: error handling.
    }
    catch (ArgumentOutOfRangeException)
    {
        // A value greater than 100 or less than 0 is passed in 
        // (except -1 which is equivalent to NoScroll).
        // TO DO: error handling.
    }
}

.NET Framework
Available since 3.0
Return to top
Show: