Export (0) Print
Expand All

SelectionPattern.SelectionProperty Field

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

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

'Declaration
Public Shared ReadOnly SelectionProperty As AutomationProperty

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.

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

'''-------------------------------------------------------------------- 
''' <summary> 
''' Gets the currently selected SelectionItem objects from target. 
''' </summary> 
''' <param name="selectionContainer"> 
''' The current Selection container object. 
''' </param> 
'''-------------------------------------------------------------------- 
Private Function GetCurrentSelectionProperty( _
ByVal selectionContainer As AutomationElement) As AutomationElement()
    Try 
        Return DirectCast(selectionContainer.GetCurrentPropertyValue( _
        SelectionPattern.SelectionProperty), AutomationElement())
        ' Container is not enabled 
    Catch 
        Return Nothing 
    End Try 
End Function 'GetCurrentSelectionProperty

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft