Share via


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 自动化客户端应用程序使用此标识符。 UI 自动化提供程序应使用 中的 AutomationElementIdentifiers等效标识符。

也可以从 CurrentCached 属性检索此属性。

当提供程序表示没有明确定义的控件类型的自定义控件时,需要提供程序来公开此属性。

属性的返回值的类型为 String。 属性的默认值为空字符串。

适用于

另请参阅