AutomationPattern 類別

定義

識別控制項模式。

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 支援的 AutomationElement 模式。

下列範例示範如何要求特定模式。

/// <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

備註

此類型的實例會識別特定的控制項模式。 例如, DockPattern.Pattern 欄位會 DockPattern 識別控制項模式。

屬性

Id

取得基礎數值識別項。

(繼承來源 AutomationIdentifier)
ProgrammaticName

取得註冊的程式設計名稱。

(繼承來源 AutomationIdentifier)

方法

CompareTo(Object)

將此 AutomationIdentifier 與另一個 AutomationIdentifier 比較。

(繼承來源 AutomationIdentifier)
Equals(Object)

傳回的值表示提供的 AutomationIdentifier 是否相當於這個 AutomationIdentifier

(繼承來源 AutomationIdentifier)
GetHashCode()

傳回此 UI 自動化識別碼的雜湊碼。

(繼承來源 AutomationIdentifier)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
LookupById(Int32)

擷取一個可以封裝指定之數值識別項的 AutomationPattern

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱