InvokePattern.Pattern Feld

Definition

Bezeichnet das InvokePattern-Steuerelementmuster.

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 

Feldwert

AutomationPattern

Beispiele

Im folgenden Beispiel wird ein InvokePattern Steuerelementmuster aus einem Steuerelement abgerufen und die Invoke Methode aufgerufen.

///--------------------------------------------------------------------
/// <summary>
/// Obtains an InvokePattern control pattern from a control
/// and calls the InvokePattern.Invoke() method on the control.
/// </summary>
/// <param name="targetControl">
/// The control of interest.
/// </param>
///--------------------------------------------------------------------
private void InvokeControl(AutomationElement targetControl)
{
    InvokePattern invokePattern = null;

    try
    {
        invokePattern =
            targetControl.GetCurrentPattern(InvokePattern.Pattern)
            as InvokePattern;
    }
    catch (ElementNotEnabledException)
    {
        // Object is not enabled
        return;
    }
    catch (InvalidOperationException)
    {
        // object doesn't support the InvokePattern control pattern
        return;
    }

    invokePattern.Invoke();
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains an InvokePattern control pattern from a control
''' and calls the InvokePattern.Invoke() method on the control.
''' </summary>
''' <param name="targetControl">
''' The control of interest.
''' </param>
'''--------------------------------------------------------------------
Private Sub InvokeControl(ByVal targetControl As AutomationElement) 
    Dim invokePattern As InvokePattern = Nothing
    
    Try
        invokePattern = _
        DirectCast(targetControl.GetCurrentPattern(invokePattern.Pattern), _
        InvokePattern)
    Catch e As ElementNotEnabledException
        ' Object is not enabled.
        Return
    Catch e As InvalidOperationException
        ' Object doesn't support the InvokePattern control pattern
        Return
    End Try
    
    invokePattern.Invoke()

End Sub

Hinweise

Dieser Bezeichner wird von Benutzeroberflächenautomatisierung Clientanwendungen verwendet. Benutzeroberflächenautomatisierung Anbieter sollten das entsprechende Feld in InvokePatternIdentifiersverwenden.

Der Musterbezeichner wird an Methoden übergeben, zGetCurrentPattern. B. zum Abrufen des Steuerelementmusters von Interesse aus dem angegebenen .AutomationElement

Gilt für

Siehe auch