Поделиться через


SelectionItemPattern.SelectionContainerProperty Поле

Определение

Определяет свойство SelectionContainer.

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

Значение поля

Примеры

В следующем примере показано, как получить объект , AutomationElement представляющий контейнер выделения элемента выделения.

///--------------------------------------------------------------------
/// <summary>
/// Retrieves the selection items for a selection container.
/// </summary>
/// <param name="rootElement">
/// The automation element from which to start searching.
/// </param>
/// <param name="selectionContainer">
/// An automation element that supports SelectionPattern.
/// </param>
/// <returns>
/// A collection of automation elements satisfying 
/// the specified condition(s).
/// </returns>
///--------------------------------------------------------------------
private AutomationElementCollection FindElementBasedOnContainer(
    AutomationElement rootElement, AutomationElement selectionContainer)
{
    PropertyCondition containerCondition = 
        new PropertyCondition(
        SelectionItemPattern.SelectionContainerProperty, 
        selectionContainer);
    AutomationElementCollection selectionItems = 
        rootElement.FindAll(TreeScope.Descendants, containerCondition);
    return selectionItems;
}
'''--------------------------------------------------------------------
''' <summary>
''' Retrieves the selection items for a selection container.
''' </summary>
''' <param name="rootElement">
''' The automation element from which to start searching.
''' </param>
''' <param name="selectionContainer">
''' An automation element that supports SelectionPattern.
''' </param>
''' <returns>
''' A collection of automation elements satisfying 
''' the specified condition(s).
''' </returns>
'''--------------------------------------------------------------------
Private Function FindElementBasedOnContainer( _
ByVal rootElement As AutomationElement, _
ByVal selectionContainer As AutomationElement) As AutomationElementCollection
    Dim containerCondition As PropertyCondition = _
        New PropertyCondition( _
        SelectionItemPattern.SelectionContainerProperty, _
        selectionContainer)
    Dim selectionItems As AutomationElementCollection = _
        rootElement.FindAll(TreeScope.Descendants, containerCondition)
    Return selectionItems
End Function

Комментарии

Этот идентификатор используется модель автоматизации пользовательского интерфейса клиентскими приложениями. модель автоматизации пользовательского интерфейса поставщики должны использовать эквивалентное поле в SelectionItemPatternIdentifiers.

Применяется к