Editar

Compartilhar via


Automation.PatternName(AutomationPattern) Method

Definition

Retrieves the name of the specified control pattern.

public:
 static System::String ^ PatternName(System::Windows::Automation::AutomationPattern ^ pattern);
public static string PatternName (System.Windows.Automation.AutomationPattern pattern);
static member PatternName : System.Windows.Automation.AutomationPattern -> string
Public Shared Function PatternName (pattern As AutomationPattern) As String

Parameters

pattern
AutomationPattern

The identifier of the control pattern.

Returns

The friendly name of the control pattern, or a null reference (Nothing in Visual Basic) if the specified pattern is not found.

Examples

The following example displays the name of each control pattern supported by an AutomationElement.

Note

Calling GetSupportedPatterns requires a great deal of processing, as it queries the AutomationElement for every possible pattern.

// element is an AutomationElement.
AutomationPattern[] patterns = element.GetSupportedPatterns();
foreach (AutomationPattern pattern in patterns)
{
    Console.WriteLine("ProgrammaticName: " + pattern.ProgrammaticName);
    Console.WriteLine("PatternName: " + Automation.PatternName(pattern));
}
' element is an AutomationElement.
Dim patterns As AutomationPattern() = element.GetSupportedPatterns()
Dim pattern As AutomationPattern
For Each pattern In patterns
    Console.WriteLine("ProgrammaticName: " + pattern.ProgrammaticName)
    Console.WriteLine("PatternName: " + Automation.PatternName(pattern))
Next pattern

Applies to