SelectionPattern.SelectionProperty Veld

Definitie

Hiermee wordt de eigenschap geïdentificeerd waarmee de geselecteerde items in een container worden opgeslagen.

public: static initonly System::Windows::Automation::AutomationProperty ^ SelectionProperty;
public static readonly System.Windows.Automation.AutomationProperty SelectionProperty;
 staticval mutable SelectionProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly SelectionProperty As AutomationProperty 

Waarde van veld

Voorbeelden

In het volgende voorbeeld wordt een verzameling AutomationElementitems die de geselecteerde items in een selectiecontainer vertegenwoordigen, verkregen.

///--------------------------------------------------------------------
/// <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;
    }
}
'''--------------------------------------------------------------------
''' <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

Opmerkingen

Deze id wordt gebruikt door UI Automation clienttoepassingen. UI Automation providers moeten het equivalente veld in SelectionPatternIdentifiers gebruiken.

Deze eigenschap is niet aanwezig SelectionPattern.SelectionPatternInformation en moet worden opgehaald met behulp van GetCurrentPropertyValue of GetCachedPropertyValue.

Van toepassing op