AutomationPattern 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
識別控制模式。
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
- 繼承
範例
以下範例展示了 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 控制模式。
屬性
| 名稱 | Description |
|---|---|
| Id |
取得底層的數字識別碼。 (繼承來源 AutomationIdentifier) |
| ProgrammaticName |
取得註冊的程式化名稱。 (繼承來源 AutomationIdentifier) |
方法
| 名稱 | Description |
|---|---|
| CompareTo(Object) |
將此 AutomationIdentifier 與另一項 AutomationIdentifier。 (繼承來源 AutomationIdentifier) |
| Equals(Object) |
回傳一個值,表示所提供的 AutomationIdentifier 是否等價於此 AutomationIdentifier。 (繼承來源 AutomationIdentifier) |
| GetHashCode() |
回傳此 使用者介面自動化 識別碼的雜湊碼。 (繼承來源 AutomationIdentifier) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| LookupById(Int32) |
取得封裝指定數值識別碼的 。AutomationPattern |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |