IRawElementProviderSimple.GetPatternProvider(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Collaborer avec nous sur GitHub
La source de ce contenu se trouve sur GitHub, où vous pouvez également créer et examiner les problèmes et les demandes de tirage. Pour plus d’informations, consultez notre guide du contributeur.