SelectionPattern.SelectionProperty Pole

Definice

Identifikuje vlastnost, která získá vybrané položky v kontejneru.

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 

Hodnota pole

Příklady

V následujícím příkladu AutomationElementje získána kolekce s představující vybrané položky v kontejneru výběru.

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

Poznámky

Tento identifikátor používá model UI Automation klientských aplikací. model UI Automation poskytovatelé by měli použít ekvivalentní pole v SelectionPatternIdentifierssouboru .

Tato vlastnost se v nástroji SelectionPattern.SelectionPatternInformation nenachází a musí se načíst pomocí nebo GetCurrentPropertyValueGetCachedPropertyValue.

Platí pro