Bagikan melalui


ValuePattern.Pattern Bidang

Definisi

ValuePattern Mengidentifikasi pola kontrol.

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

Nilai Bidang

Contoh

Dalam contoh berikut, ValuePattern pola kontrol diperoleh dari AutomationElement.

///--------------------------------------------------------------------
/// <summary>
/// Obtains a ValuePattern control pattern from an 
/// automation element.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
/// <returns>
/// A ValuePattern object.
/// </returns>
///--------------------------------------------------------------------
private ValuePattern GetValuePattern(
    AutomationElement targetControl)
{
    ValuePattern valuePattern = null;

    try
    {
        valuePattern =
            targetControl.GetCurrentPattern(
            ValuePattern.Pattern)
            as ValuePattern;
    }
    // Object doesn't support the ValuePattern control pattern
    catch (InvalidOperationException)
    {
        return null;
    }

    return valuePattern;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains a ValuePattern control pattern from an 
''' automation element.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
''' <returns>
''' A ValuePattern object.
''' </returns>
'''--------------------------------------------------------------------
Private Function GetValuePattern( _
ByVal targetControl As AutomationElement) As ValuePattern
    Dim valuePattern As ValuePattern = Nothing

    Try
        valuePattern = DirectCast( _
        targetControl.GetCurrentPattern(valuePattern.Pattern), _
        ValuePattern)
    Catch
        Return Nothing
    End Try

    Return valuePattern

End Function 'GetValuePattern

Keterangan

Pengidentifikasi ini digunakan oleh aplikasi klien Automation UI. Penyedia Automation UI harus menggunakan bidang yang setara di ValuePatternIdentifiers.

Pengidentifikasi pola diteruskan ke metode seperti GetCurrentPattern untuk mengambil pola kontrol yang menarik dari yang ditentukan AutomationElement.

Berlaku untuk

Lihat juga