AutomationElement.LocalizedControlTypeProperty 欄位

定義

識別地區語言的 LocalizedControlType 屬性。

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

欄位值

範例

下列範例會擷取 屬性的目前值。 如果元素未提供預設值,則會傳回預設值。

string localizedType =
    autoElement.GetCurrentPropertyValue(AutomationElement.LocalizedControlTypeProperty) as string;
Dim localizedType As String = _
    Cstr(autoElement.GetCurrentPropertyValue(AutomationElement.LocalizedControlTypeProperty))

下列範例會擷取屬性的目前值,但指定如果專案本身未提供屬性的值, NotSupported 則會傳回而不是預設值。

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

備註

UI 自動化用戶端應用程式會使用此識別碼。 使用者介面自動化提供者應該使用 中的 AutomationElementIdentifiers 對等識別碼。

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

當提供者代表沒有定義完善的控制項類型的自訂控制項時,就必須公開這個屬性。

屬性的傳回值的類型為 String 。 屬性的預設值是空字串。

適用於

另請參閱