Modifica

Condividi tramite


IRawElementProviderSimple.GetPatternProvider(Int32) Method

Definition

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

public:
 System::Object ^ GetPatternProvider(int patternId);
public object GetPatternProvider (int patternId);
abstract member GetPatternProvider : int -> obj
Public Function GetPatternProvider (patternId As Integer) As Object

Parameters

patternId
Int32

Identifier of the pattern.

Returns

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

Examples

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;
    }
}
''' <summary>
''' Returns the object that supports the specified pattern.
''' </summary>
''' <param name="patternId">ID of the pattern.</param>
''' <returns>Object that implements IInvokeProvider.</returns>
Function GetPatternProvider(ByVal patternId As Integer) As Object _
    Implements IRawElementProviderSimple.GetPatternProvider
    If patternId = InvokePatternIdentifiers.Pattern.Id Then
        ' Return an object that implements IInvokeProvider.
        Return myInvokePatternProvider
    Else
        Return Nothing
    End If

End Function 'IRawElementProviderSimple.GetPatternProvider

Applies to

See also