SelectionItemPattern.SelectionItemPatternInformation.SelectionContainer Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the AutomationElement that supports the SelectionPattern control pattern and acts as the container for the calling object.
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
Property Value
The container object. The default is a null reference (Nothing
in Visual Basic).
Examples
The following example shows how to retrieve the AutomationElement representing the selection container of a selection item.
///--------------------------------------------------------------------
/// <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
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET