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 

欄位值

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 對等識別碼。

您也可以從 CurrentCached 屬性擷取這個屬性。

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

適用於

另請參閱