Condividi tramite


GridItemPattern.Pattern Campo

Definizione

Identifica il pattern di controllo GridItemPattern.

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

Esempio

Nell'esempio seguente viene ottenuto un GridItemPattern pattern di controllo da un oggetto AutomationElement.

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

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

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

    Try
        gridItemPattern = DirectCast( _
        targetControl.GetCurrentPattern(gridItemPattern.Pattern), _
        GridItemPattern)
    Catch exc As InvalidOperationException
        ' Object doesn't support the 
        ' GridPattern control pattern
        Return Nothing
    End Try

    Return gridItemPattern

End Function 'GetGridItemPattern

Commenti

Questo identificatore viene usato da Automazione interfaccia utente applicazioni client. Automazione interfaccia utente provider devono usare il campo equivalente in GridItemPatternIdentifiers.

L'identificatore del modello viene passato a metodi quali GetCurrentPattern per recuperare il pattern di controllo di interesse dall'oggetto specificato AutomationElement.

Si applica a