Aracılığıyla paylaş


SelectionPattern.Pattern Alan

Tanım

Denetim desenini SelectionPattern tanımlar.

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 

Alan Değeri

AutomationPattern

Örnekler

Aşağıdaki örnekte, bir SelectionPattern denetim deseni bir AutomationElement'den elde edilir.

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

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

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

    Try
        selectionPattern = DirectCast( _
        targetControl.GetCurrentPattern(selectionPattern.Pattern), _
        SelectionPattern)
    ' Object doesn't support the SelectionPattern control pattern
    Catch
        Return Nothing
    End Try

    Return selectionPattern
End Function 'GetSelectionPattern

Açıklamalar

Bu tanımlayıcı, UI Otomasyonu istemci uygulamaları tarafından kullanılır. UI Otomasyonu sağlayıcıları içindeki SelectionPatternIdentifierseşdeğer alanı kullanmalıdır.

Desen tanımlayıcısı, belirtilen AutomationElementiçinden ilgilendiğin denetim desenini almak gibi GetCurrentPattern yöntemlere geçirilir.

Şunlara uygulanır