SelectionItemPattern.Pattern Campo

Definizione

Identifica il pattern di controllo SelectionItemPattern.Identifies the SelectionItemPattern control pattern.

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 

Valore del campo

Esempi

Nell'esempio seguente viene ottenuto un SelectionItemPattern pattern di controllo da un oggetto AutomationElement.In the following example, a SelectionItemPattern control pattern is obtained from an AutomationElement.

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

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

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

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

    Return selectionItemPattern
End Function 'GetSelectionItemPattern

Commenti

Questo identificatore viene usato dalle applicazioni client di automazione interfaccia utente.This identifier is used by UI Automation client applications. I provider di automazione interfaccia utente devono usare il SelectionItemPatternIdentifierscampo equivalente in.UI Automation providers should use the equivalent field in SelectionItemPatternIdentifiers.

L'identificatore del modello viene passato a metodi come GetCurrentPattern per recuperare il pattern di controllo di interesse dall'oggetto AutomationElementspecificato.The pattern identifier is passed to methods such as GetCurrentPattern to retrieve the control pattern of interest from the specified AutomationElement.

Si applica a