AutomationElement.ClassNameProperty フィールド

定義

ClassName プロパティを識別します。

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

フィールド値

次の例では、 プロパティの現在の値を取得します。 要素に指定されていない場合は、既定値が返されます。

string className =
    autoElement.GetCurrentPropertyValue(AutomationElement.ClassNameProperty) as string;
Dim className As Object = autoElement.GetCurrentPropertyValue(AutomationElement.ClassNameProperty)

次の例では、 プロパティの現在の値を取得しますが、要素自体がプロパティの値を提供しない場合は、 NotSupported 既定値ではなく を返すように指定します。

string classNameString;
object classNameNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.ClassNameProperty, true);
if (classNameNoDefault == AutomationElement.NotSupported)
{
    // TODO Handle the case where you do not wish to proceed using the default value.
}
else
{
    classNameString = classNameNoDefault as string;
}
Dim classNameString As String
Dim classNameNoDefault As Object = autoElement.GetCurrentPropertyValue(AutomationElement.ClassNameProperty, True)
If classNameNoDefault Is AutomationElement.NotSupported Then
    ' TODO Handle the case where you do not wish to proceed using the default value.
Else
    classNameString = CStr(classNameNoDefault)
End If

注釈

この識別子は、UI オートメーション クライアント アプリケーションで使用されます。 UI オートメーション プロバイダーでは、 で AutomationElementIdentifiers同等の識別子を使用する必要があります。

このプロパティは、 または Cached プロパティからCurrent取得することもできます。

クラス名は UI オートメーション プロバイダーの実装に依存するため、標準形式であると見なすことはできません。 ただし、クラス名がわかっている場合は、それを使用して、アプリケーションが想定される UI オートメーション要素で動作していることを確認できます。

プロパティの戻り値は 型 Stringです。 既定値は空の文字列です。

適用対象

こちらもご覧ください