SelectionPattern.SelectionProperty Campo

Definición

Identifica la propiedad que obtiene los elementos seleccionados en un contenedor.

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 

Valor de campo

Ejemplos

En el ejemplo siguiente, se obtiene una colección de AutomationElements que representa los elementos seleccionados en un contenedor de selección.

///--------------------------------------------------------------------
/// <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

Comentarios

Este identificador lo usan las aplicaciones cliente de Automatización de la interfaz de usuario. Automatización de la interfaz de usuario proveedores deben usar el campo equivalente en SelectionPatternIdentifiers.

Esta propiedad no está presente en SelectionPattern.SelectionPatternInformation y debe recuperarse mediante GetCurrentPropertyValue o GetCachedPropertyValue.

Se aplica a