語言

AutomationElement.ItemTypeProperty 欄位

定義

識別該 ItemType 物業。

public: static initonly System::Windows::Automation::AutomationProperty ^ ItemTypeProperty;
public static readonly System.Windows.Automation.AutomationProperty ItemTypeProperty;
 staticval mutable ItemTypeProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly ItemTypeProperty As AutomationProperty 

欄位值

範例

以下範例取得該屬性的當前值。 若元素未提供預設值,則回傳預設值。

string itemType =
    autoElement.GetCurrentPropertyValue(AutomationElement.ItemTypeProperty) as string;
Dim itemType As String = _
    CStr(autoElement.GetCurrentPropertyValue(AutomationElement.ItemTypeProperty))

以下範例取得該屬性的當前值,但規定若元素本身未提供屬性值,則回傳應用程式定義的字串而非預設值。

string itemType1;
object itemTypeNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.ItemTypeProperty, true);
if (itemTypeNoDefault == AutomationElement.NotSupported)
{
    itemType1 = "Unknown type";
}
else
{
    itemType1 = itemStatusNoDefault as string;
}
Dim itemType1 As String
Dim itemTypeNoDefault As Object = _
    autoElement.GetCurrentPropertyValue(AutomationElement.ItemTypeProperty, True)
If itemTypeNoDefault Is AutomationElement.NotSupported Then
    itemType1 = "Unknown type"
Else
    itemType1 = CStr(itemStatusNoDefault)
End If

備註

此識別碼用於 使用者介面自動化 客戶端應用程式。 使用者介面自動化提供者應使用等效的識別碼為 AutomationElementIdentifiers。

此屬性也可從 Current 或 Cached 屬性中取得。

回傳值為控制定義 String的 。 預設值為空字串。

適用於

另請參閱