SelectionPattern.SelectionProperty Field

Definition

Identifies the property that gets the selected items in a container.

C#
public static readonly System.Windows.Automation.AutomationProperty SelectionProperty;

Field Value

Examples

In the following example, a collection of AutomationElements representing the selected items in a selection container is obtained.

C#
///--------------------------------------------------------------------
/// <summary>
/// Gets the currently selected SelectionItem objects from target.
/// </summary>
/// <param name="selectionContainer">
/// The current Selection container object.
/// </param>
///--------------------------------------------------------------------
private AutomationElement[] GetCurrentSelectionProperty(
    AutomationElement selectionContainer)
{
    try
    {
        return selectionContainer.GetCurrentPropertyValue(
            SelectionPattern.SelectionProperty) as AutomationElement[];
    }
    // Container is not enabled
    catch (InvalidOperationException)
    {
        return null;
    }
}

Remarks

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

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

Applies to

Prodotto Versioni
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10