SelectionChangedEventArgs 클래스


SelectionChanged 이벤트에 대한 데이터를 제공합니다.Provides data for the SelectionChanged event.

public ref class SelectionChangedEventArgs : System::Windows::RoutedEventArgs
public class SelectionChangedEventArgs : System.Windows.RoutedEventArgs
type SelectionChangedEventArgs = class
    inherit RoutedEventArgs
Public Class SelectionChangedEventArgs
Inherits RoutedEventArgs


다음 예에서는 ListBox 하 고 구독을 SelectionChanged 이벤트입니다.The following example creates a ListBox and subscribes to the SelectionChanged event. 사용 된 SelectionChangedEventArgs 에서 선택한 항목을 찾을 ListBox.It uses the SelectionChangedEventArgs to find the selected item in the ListBox.

<WrapPanel Width="500" Orientation="Horizontal" Name="rectanglesPanel">
    <Style TargetType="Rectangle">
      <Setter Property="Height" Value="20"/>
      <Setter Property="Width" Value="20"/>
      <Setter Property="Margin" Value="5"/>

<ListBox Name="myListBox" HorizontalAlignment="Left" SelectionMode="Extended" 
      Width="265" Height="55" Background="HoneyDew" SelectionChanged="myListBox_SelectionChanged"
      ItemsSource="{Binding Source={StaticResource Colors}}" IsSynchronizedWithCurrentItem="true">

void myListBox_SelectionChanged(object sender, SelectionChangedEventArgs args)

    BrushConverter converter = new BrushConverter();

    // Show Rectangles that are the selected colors.
    foreach (string color in args.AddedItems)
        if (GetRectangle(color) == null)
            Rectangle aRect = new Rectangle();
            aRect.Fill = (Brush) converter.ConvertFrom(color);
            aRect.Tag = color;

    // Remove the Rectangles that are the unselected colors.
    foreach (string color in args.RemovedItems)
        FrameworkElement removedItem = GetRectangle(color);
        if (removedItem != null)

FrameworkElement GetRectangle(string color)
    foreach (FrameworkElement rect in rectanglesPanel.Children)
        if (rect.Tag.ToString() == color)
            return rect;

    return null;
Private Sub myListBox_SelectionChanged(ByVal sender As Object, ByVal args As SelectionChangedEventArgs)

    Dim converter As BrushConverter = New BrushConverter()
    Dim color As String

    ' Show Rectangles that are the selected colors.
    For Each color In args.AddedItems

        If GetRectangle(color) Is Nothing Then
            Dim aRect As Rectangle = New Rectangle()
            aRect.Fill = CType(converter.ConvertFrom(color), Brush)
            aRect.Tag = color
        End If


    ' Remove the Rectangles that are the unselected colors.
    For Each color In args.RemovedItems

        Dim removedItem As FrameworkElement = GetRectangle(color)
        If Not removedItem Is Nothing Then
        End If


End Sub

Private Function GetRectangle(ByVal color As String) As FrameworkElement
    Dim rect As FrameworkElement
    For Each rect In rectanglesPanel.Children
        If rect.Tag.ToString() = color Then
            Return rect
        End If

    Return Nothing
End Function


SelectionChangedEventArgs(RoutedEvent, IList, IList)

SelectionChangedEventArgs 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the SelectionChangedEventArgs class.



선택한 항목을 포함하는 목록을 가져옵니다.Gets a list that contains the items that were selected.


경로를 따라 이동할 때 라우트된 이벤트의 현재 이벤트 처리 상태를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.

(다음에서 상속됨 RoutedEventArgs)

부모 클래스에 의한 Source 조정 앞에 순수 적중 횟수 테스트에서 결정한 원본 보고 소스를 가져옵니다.Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class.

(다음에서 상속됨 RoutedEventArgs)

선택이 취소된 항목을 포함하는 목록을 가져옵니다.Gets a list that contains the items that were unselected.


RoutedEventArgs 인스턴스와 연결된 RoutedEvent를 가져오거나 설정합니다.Gets or sets the RoutedEvent associated with this RoutedEventArgs instance.

(다음에서 상속됨 RoutedEventArgs)

이벤트를 발생시킨 개체에 대한 참조를 가져오거나 설정합니다.Gets or sets a reference to the object that raised the event.

(다음에서 상속됨 RoutedEventArgs)



지정된 개체가 현재 개체와 같은지 확인합니다.Determines whether the specified object is equal to the current object.

(다음에서 상속됨 Object)

기본 해시 함수로 작동합니다.Serves as the default hash function.

(다음에서 상속됨 Object)

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(다음에서 상속됨 Object)
InvokeEventHandler(Delegate, Object)

적절한 형식 캐스팅을 수행하여 SelectionChangedEventHandler 이벤트에 대한 형식이 안전한 SelectionChanged 대리자를 호출합니다.Performs the proper type casting to call the type-safe SelectionChangedEventHandler delegate for the SelectionChanged event.


현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(다음에서 상속됨 Object)

파생된 클래스에서 재정의되는 경우 인스턴스의 Source 속성 값이 변경될 때마다 알림 콜백 진입점을 제공합니다.When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes.

(다음에서 상속됨 RoutedEventArgs)

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(다음에서 상속됨 Object)

적용 대상

추가 정보