SelectionPattern.SelectionProperty Campo

Definizione

Identifica la proprietà che ottiene gli elementi selezionati in un contenitore.

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 

Valore del campo

AutomationProperty

Esempio

Nell'esempio seguente viene ottenuta una raccolta di AutomationElementoggetti che rappresenta gli elementi selezionati in un contenitore di selezione.

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

Commenti

Questo identificatore viene usato da Automazione interfaccia utente applicazioni client. Automazione interfaccia utente provider devono usare il campo equivalente in SelectionPatternIdentifiers.

Questa proprietà non è presente in SelectionPattern.SelectionPatternInformation e deve essere recuperata tramite GetCurrentPropertyValue o GetCachedPropertyValue.

Si applica a