ExpandCollapsePattern.Pattern Field

 

Identifies the ExpandCollapsePattern control pattern.

Namespace:   System.Windows.Automation
Assembly:  UIAutomationClient (in UIAutomationClient.dll)

Public Shared ReadOnly Pattern As AutomationPattern

This identifier is used by UI Automation client applications. UI Automation providers should use the equivalent field in ExpandCollapsePatternIdentifiers.

The pattern identifier (ID) is passed to methods such as GetCurrentPattern to retrieve the control pattern of interest from the specified AutomationElement.

In the following example, a ExpandCollapsePattern control pattern is obtained from a UI Automation element.

'''--------------------------------------------------------------------
''' <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    

.NET Framework
Available since 3.0

ExpandCollapsePattern Class
System.Windows.Automation Namespace
InvokePattern and ExpandCollapsePattern Menu Item Sample

Return to top
Show: