BindingList<T>.ListChanged 事件

定义

当列表或列表中的项更改时发生。Occurs when the list or an item in the list changes.

public:
 virtual event System::ComponentModel::ListChangedEventHandler ^ ListChanged;
public event System.ComponentModel.ListChangedEventHandler ListChanged;
member this.ListChanged : System.ComponentModel.ListChangedEventHandler 
Public Custom Event ListChanged As ListChangedEventHandler 

实现

示例

下面的代码示例演示如何处理 ListChanged 事件。The following code example demonstrates how handle the ListChanged event. 有关完整示例,请参阅 BindingList<T> 类概述主题。For the complete example, see the BindingList<T> class overview topic.

void listOfParts_ListChanged(object sender, ListChangedEventArgs e)
{
    MessageBox.Show(e.ListChangedType.ToString());
}

注解

仅当列表项类型实现 INotifyPropertyChanged 接口时,才会引发项值更改 ListChanged 通知。ListChanged notifications for item value changes are only raised if the list item type implements the INotifyPropertyChanged interface.

有关如何处理事件的详细信息,请参阅处理和引发事件For more information about how to handle events, see Handling and Raising Events.

适用于

另请参阅