다음을 통해 공유


SelectionItemPattern.SelectionItemPatternInformation.SelectionContainer 속성

정의

SelectionPattern 컨트롤 패턴을 지원하고 호출하는 개체에 대한 컨테이너 역할을 하는 AutomationElement를 가져옵니다.

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

속성 값

AutomationElement

컨테이너 개체입니다. 기본값은 null 참조(Visual Basic의 경우 Nothing)입니다.

예제

다음 예제에서는 검색 하는 방법을 보여 줍니다는 AutomationElement 선택 항목의 선택 항목 컨테이너를 나타내는입니다.

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

적용 대상