ValuePattern.Pattern Field

Definition

Identifies the ValuePattern control pattern.

public static readonly System.Windows.Automation.AutomationPattern Pattern;

Field Value

Examples

In the following example, a ValuePattern control pattern is obtained from an AutomationElement.

///--------------------------------------------------------------------
/// <summary>
/// Obtains a ValuePattern control pattern from an 
/// automation element.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
/// <returns>
/// A ValuePattern object.
/// </returns>
///--------------------------------------------------------------------
private ValuePattern GetValuePattern(
    AutomationElement targetControl)
{
    ValuePattern valuePattern = null;

    try
    {
        valuePattern =
            targetControl.GetCurrentPattern(
            ValuePattern.Pattern)
            as ValuePattern;
    }
    // Object doesn't support the ValuePattern control pattern
    catch (InvalidOperationException)
    {
        return null;
    }

    return valuePattern;
}

Remarks

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

The pattern identifier is passed to methods such as GetCurrentPattern to retrieve the control pattern of interest from the specified AutomationElement.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also