InvokePattern.Pattern Field

 

Identifies the InvokePattern control pattern.

Namespace:   System.Windows.Automation
Assembly:  UIAutomationClient (in UIAutomationClient.dll)

Public Shared ReadOnly Pattern As AutomationPattern

This identifier is used by UI Automation client applications. UI Automation providers should use the equivalent field in InvokePatternIdentifiers.

The pattern identifier is passed to methods such as GetCurrentPattern to retrieve the control pattern of interest from the specified AutomationElement.

In the following example an InvokePattern control pattern is obtained from a control and the Invoke method is called.

'''--------------------------------------------------------------------
''' <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 'InvokeControl

.NET Framework
Available since 3.0
Return to top
Show: