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 で同等の識別子を使用する必要があります。

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

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

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

適用対象

こちらもご覧ください