MultipleViewPattern.SupportedViewsProperty Field

 

Identifies the property that gets the control-specific collection of views.

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

public static readonly AutomationProperty SupportedViewsProperty

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

This property is not present in MultipleViewPattern.MultipleViewPatternInformation and must be retrieved by using GetCurrentPropertyValue or GetCachedPropertyValue.

In the following example, a collection of integer identifiers is obtained that represents the current views available for a control that supports MultipleViewPattern.

///--------------------------------------------------------------------
/// <summary>
/// Finds all automation elements that satisfy 
/// the specified condition(s).
/// </summary>
/// <param name="targetApp">
/// The automation element from which to start searching.
/// </param>
/// <returns>
/// A collection of automation elements satisfying 
/// the specified condition(s).
/// </returns>
///--------------------------------------------------------------------
private AutomationElementCollection FindAutomationElement(
    AutomationElement targetApp)
{
    if (targetApp == null)
    {
        throw new ArgumentException("Root element cannot be null.");
    }

    PropertyCondition conditionSupportsMultipleView =
        new PropertyCondition(
        AutomationElement.IsMultipleViewPatternAvailableProperty, true);

    return targetApp.FindAll(
        TreeScope.Descendants, conditionSupportsMultipleView);
}
///--------------------------------------------------------------------
/// <summary>
/// Gets the collection of currently supported views from a target.
/// </summary>
/// <param name="multipleViewControl">
/// The current multiple view control.
/// </param>
/// <returns>
/// A collection of identifiers representing the supported views.
/// </returns>
///--------------------------------------------------------------------
private int[] GetSupportedViewsFromPattern(
    AutomationElement multipleViewControl)
{
    if (multipleViewControl == null)
    {
        throw new ArgumentNullException(
            "AutomationElement parameter must not be null.");
    }

    return multipleViewControl.GetCurrentPropertyValue(
        MultipleViewPattern.SupportedViewsProperty) as int[];
}

.NET Framework
Available since 3.0
Return to top
Show: