ExpandCollapsePattern.Pattern Field


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Identifies the ExpandCollapsePattern control pattern.

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

public static readonly AutomationPattern Pattern

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 ExpandCollapsePattern GetExpandCollapsePattern(
    AutomationElement targetControl)
    ExpandCollapsePattern expandCollapsePattern = null;

        expandCollapsePattern =
            as ExpandCollapsePattern;
    // Object doesn't support the ExpandCollapsePattern control pattern.
    catch (InvalidOperationException)
        return null;

    return expandCollapsePattern;

.NET Framework
Available since 3.0

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

Return to top