AutomationPattern 類別

定義

識別控制項模式。Identifies a control pattern.

public ref class AutomationPattern : System::Windows::Automation::AutomationIdentifier
public class AutomationPattern : System.Windows.Automation.AutomationIdentifier
type AutomationPattern = class
    inherit AutomationIdentifier
Public Class AutomationPattern
Inherits AutomationIdentifier
繼承
AutomationPattern

範例

下列範例會顯示所 ProgrammaticName 支援的模式 AutomationElementThe following example displays the ProgrammaticName of patterns supported by an AutomationElement.

下列範例顯示如何要求特定模式。The following example shows how to request a specific pattern.

/// <summary>
/// Retrieves the selection container for a selection item.
/// </summary>
/// <param name="listItem">
/// An element that supports SelectionItemPattern.
/// </param>
AutomationElement GetListItemParent(AutomationElement listItem)
{
    if (listItem == null) throw new ArgumentException();
    SelectionItemPattern pattern = listItem.GetCurrentPattern(SelectionItemPattern.Pattern) as SelectionItemPattern;
    if (pattern == null)
    {
        return null;
    }
    else
    {
        SelectionItemPattern.SelectionItemPatternInformation properties = pattern.Current;
        return properties.SelectionContainer;
    }
}
''' <summary>
''' Retrieves the selection container for a selection item.
''' </summary>
''' <param name="listItem">
''' An element that supports SelectionItemPattern.
''' </param>
Function GetListItemParent(ByVal listItem As AutomationElement) As AutomationElement
    If listItem Is Nothing Then
        Throw New ArgumentException()
    End If
    Dim pattern As SelectionItemPattern = _
        DirectCast(listItem.GetCurrentPattern(SelectionItemPattern.Pattern), SelectionItemPattern)
    If pattern Is Nothing Then
        Return Nothing
    Else
        Dim properties As SelectionItemPattern.SelectionItemPatternInformation = pattern.Current
        Return properties.SelectionContainer
    End If

End Function 'GetListItemParent

備註

此類型的實例會識別特定的控制項模式。Instances of this type identify specific control patterns. 例如,欄位會 DockPattern.Pattern 識別 DockPattern 控制項模式。For example, the DockPattern.Pattern field identifies the DockPattern control pattern.

屬性

Id

取得基礎數值識別項。Gets the underlying numerical identifier.

(繼承來源 AutomationIdentifier)
ProgrammaticName

取得註冊的程式設計名稱。Gets the registered programmatic name.

(繼承來源 AutomationIdentifier)

方法

CompareTo(Object)

將此 AutomationIdentifier 與另一個 AutomationIdentifier 比較。Compares this AutomationIdentifier with another AutomationIdentifier.

(繼承來源 AutomationIdentifier)
Equals(Object)

傳回的值表示提供的 AutomationIdentifier 是否相當於這個 AutomationIdentifierReturns a value indicating whether the supplied AutomationIdentifier is equivalent to this AutomationIdentifier.

(繼承來源 AutomationIdentifier)
GetHashCode()

傳回此消費者介面自動化識別碼的雜湊碼。Returns the hash code for this UI Automation identifier.

(繼承來源 AutomationIdentifier)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
LookupById(Int32)

擷取一個可以封裝指定之數值識別項的 AutomationPatternRetrieves an AutomationPattern that encapsulates a specified numerical identifier.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於