TogglePattern.Pattern Champ

Définition

Identifie le modèle de contrôle 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 

Valeur de champ

Exemples

Dans l’exemple suivant, un TogglePattern modèle de contrôle est obtenu à partir d’un 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

Remarques

Cet identificateur est utilisé par UI Automation applications clientes. UI Automation fournisseurs doivent utiliser le champ équivalent dans TogglePatternIdentifiers.

L’identificateur de modèle est passé à des méthodes telles que GetCurrentPattern pour récupérer le modèle de contrôle d’intérêt à partir du spécifié AutomationElement.

S’applique à