SelectionItemPattern.SelectionItemPatternInformation.SelectionContainer Propiedad

Definición

Obtiene el AutomationElement que admite el patrón de control SelectionPattern y actúa como contenedor para el objeto que realiza la llamada.

public:
 property System::Windows::Automation::AutomationElement ^ SelectionContainer { System::Windows::Automation::AutomationElement ^ get(); };
public System.Windows.Automation.AutomationElement SelectionContainer { get; }
member this.SelectionContainer : System.Windows.Automation.AutomationElement
Public ReadOnly Property SelectionContainer As AutomationElement

Valor de propiedad

AutomationElement

Objeto contenedor. El valor predeterminado es una referencia nula (Nothing en Visual Basic).

Ejemplos

En el ejemplo siguiente se muestra cómo recuperar el AutomationElement contenedor de selección de un elemento de selección.

///--------------------------------------------------------------------
/// <summary>
/// Retrieves the selection container for a selection item.
/// </summary>
/// <param name="selectionItem">
/// An automation element that supports SelectionItemPattern.
/// </param>
///--------------------------------------------------------------------
private AutomationElement GetSelectionItemContainer(
    AutomationElement selectionItem)
{
    // Selection item cannot be null
    if (selectionItem == null)
    {
        throw new ArgumentException();
    }

    SelectionItemPattern selectionItemPattern = 
        selectionItem.GetCurrentPattern(SelectionItemPattern.Pattern) 
        as SelectionItemPattern;
    if (selectionItemPattern == null)
    {
        return null;
    }
    else
    {
        return selectionItemPattern.Current.SelectionContainer; 
    }
}
'''--------------------------------------------------------------------
''' <summary>
''' Retrieves the selection container for a selection item.
''' </summary>
''' <param name="selectionItem">
''' An automation element that supports SelectionItemPattern.
''' </param>
'''--------------------------------------------------------------------
Private Function GetSelectionItemContainer( _
ByVal selectionItem As AutomationElement) As AutomationElement
    ' Selection item cannot be null
    If selectionItem Is Nothing Then
        Throw New ArgumentException()
    End If

    Dim selectionItemPattern As SelectionItemPattern = _
    DirectCast(selectionItem.GetCurrentPattern( _
    selectionItemPattern.Pattern), SelectionItemPattern)
    If selectionItemPattern Is Nothing Then
        Return Nothing
    Else
        Return selectionItemPattern.Current.SelectionContainer
    End If
End Function 'GetSelectionItemContainer

Se aplica a