IRawElementProviderSimple.GetPatternProvider Method (Int32)

 

Retrieves an object that provides support for a control pattern on a UI Automation element.

Namespace:   System.Windows.Automation.Provider
Assembly:  UIAutomationProvider (in UIAutomationProvider.dll)

object GetPatternProvider(
	int patternId
)

Parameters

patternId
Type: System.Int32

Identifier of the pattern.

Return Value

Type: System.Object

Object that implements the pattern interface, or null if the pattern is not supported.

The following example shows an implementation of GetPatternProvider for a provider that supports only InvokePattern.

/// <summary>
/// Returns the object that supports the specified pattern.
/// </summary>
/// <param name="patternId">ID of the pattern.</param>
/// <returns>Object that implements IInvokeProvider.</returns>
object IRawElementProviderSimple.GetPatternProvider(int patternId)
{
    if (patternId == InvokePatternIdentifiers.Pattern.Id)
    {
        // Return an object that implements IInvokeProvider.
        return myInvokePatternProvider;
    }
    else
    {
        return null;
    }
}

.NET Framework
Available since 3.0
Return to top
Show: