This documentation is archived and is not being maintained.

InvokePattern.Pattern Field

Identifies the InvokePattern control pattern.

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

public static readonly AutomationPattern Pattern

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 void InvokeControl(AutomationElement targetControl)
    InvokePattern invokePattern = null;

        invokePattern =
            as InvokePattern;
    catch (ElementNotEnabledException)
        // Object is not enabled 
    catch (InvalidOperationException)
        // object doesn't support the InvokePattern control pattern 


Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0