TogglePattern.Pattern Campo

Definición

Identifica el patrón de control TogglePattern.

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 de campo

Ejemplos

En el ejemplo siguiente, se obtiene un TogglePattern patrón de control de .AutomationElement

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

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

    return togglePattern;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains a TogglePattern control pattern from an automation element.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
''' <returns>
''' A TogglePattern object.
''' </returns>
'''--------------------------------------------------------------------
Private Function GetTogglePattern( _
ByVal targetControl As AutomationElement) As TogglePattern
    Dim togglePattern As TogglePattern = Nothing

    Try
        togglePattern = DirectCast( _
        targetControl.GetCurrentPattern(togglePattern.Pattern), _
        TogglePattern)
    Catch
        ' object doesn't support the TogglePattern control pattern
        Return Nothing
    End Try

    Return togglePattern

End Function 'GetTogglePattern

Comentarios

Este identificador lo usan Automatización de la interfaz de usuario aplicaciones cliente. Automatización de la interfaz de usuario proveedores deben usar el campo equivalente en TogglePatternIdentifiers.

El identificador de patrón se pasa a métodos como GetCurrentPattern para recuperar el patrón de control de interés del especificado AutomationElement.

Se aplica a