ListBox.SelectedItems 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 currently selected items.
public:
property System::Collections::IList ^ SelectedItems { System::Collections::IList ^ get(); };
[System.ComponentModel.Bindable(true)]
public System.Collections.IList SelectedItems { get; }
[<System.ComponentModel.Bindable(true)>]
member this.SelectedItems : System.Collections.IList
Public ReadOnly Property SelectedItems As IList
Property Value
Returns a collection of the currently selected items.
- Attributes
Exceptions
The SelectionMode property is set to Single.
Examples
The following example shows how to use the SelectedItems property to determine whether a list box has any selected items.
private void SelectedItems(object sender, RoutedEventArgs e)
{
if (lb.SelectedItem != null)
{
label1.Content = "Has " + (lb.SelectedItems.Count.ToString()) + " item(s) selected.";
}
}
Private Sub SelectedItems(ByVal sender As Object, ByVal e As RoutedEventArgs)
If lb.SelectedItem IsNot Nothing Then
label1.Content = "Has " & (lb.SelectedItems.Count.ToString()) & " item(s) selected."
End If
End Sub
Remarks
This property is meant to be used when SelectionMode does not equal Single. If the selection mode is Single the correct property to use is SelectedItem.
Dependency Property Information
Identifier field | SelectedItemsProperty |
Metadata properties set to true |
None |
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기