ExpandCollapsePattern.Pattern Campo

Definizione

Identifica il pattern di controllo ExpandCollapsePattern.

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

AutomationPattern

Esempio

Nell'esempio seguente viene ottenuto un ExpandCollapsePattern pattern di controllo da un elemento Automazione interfaccia utente.

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

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

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

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

    Return expandCollapsePattern

End Function 'GetExpandCollapsePattern

Commenti

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

L'identificatore di pattern (ID) viene passato ai metodi, GetCurrentPattern ad esempio per recuperare il pattern di controllo di interesse dall'oggetto specificato AutomationElement.

Si applica a

Vedi anche