ValuePattern.Pattern Field  
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Identifies the ValuePattern control pattern.
public: static initonly System::Windows::Automation::AutomationPattern ^ Pattern;public static readonly System.Windows.Automation.AutomationPattern Pattern; staticval mutable Pattern : System.Windows.Automation.AutomationPatternPublic Shared ReadOnly Pattern As AutomationPattern 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;
}
'''--------------------------------------------------------------------
''' <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 Function GetValuePattern( _
ByVal targetControl As AutomationElement) As ValuePattern
    Dim valuePattern As ValuePattern = Nothing
    Try
        valuePattern = DirectCast( _
        targetControl.GetCurrentPattern(valuePattern.Pattern), _
        ValuePattern)
    Catch
        Return Nothing
    End Try
    Return valuePattern
End Function 'GetValuePattern
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.