Partilhar via


ValuePattern.Pattern Campo

Definição

Identifica o padrão de controle ValuePattern.

public: static initonly System::Windows::Automation::AutomationPattern ^ Pattern;
public static readonly System.Windows.Automation.AutomationPattern Pattern;
 staticval mutable Pattern : System.Windows.Automation.AutomationPattern
Public Shared ReadOnly Pattern As AutomationPattern 

Valor do campo

Exemplos

No exemplo a seguir, um ValuePattern padrão de controle é obtido de um 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

Comentários

Esse identificador é usado por aplicativos cliente da Automação da Interface do Usuário. Os provedores de Automação da Interface do Usuário devem usar o campo equivalente em ValuePatternIdentifiers.

O identificador de padrão é passado para métodos como GetCurrentPattern para recuperar o padrão de controle de interesse do especificado AutomationElement.

Aplica-se a

Confira também