通过


DataGrid.UnloadingRow 事件

定义

当对象可供重复使用时 DataGridRow 发生。

public:
 event EventHandler<System::Windows::Controls::DataGridRowEventArgs ^> ^ UnloadingRow;
public event EventHandler<System.Windows.Controls.DataGridRowEventArgs> UnloadingRow;
member this.UnloadingRow : EventHandler<System.Windows.Controls.DataGridRowEventArgs> 
Public Custom Event UnloadingRow As EventHandler(Of DataGridRowEventArgs) 
Public Event UnloadingRow As EventHandler(Of DataGridRowEventArgs) 

事件类型

注解

为了提高性能,属性 EnableRowVirtualization 默认设置为 true 。 如果属性 EnableRowVirtualization 设置为 true,则 DataGrid 不会实例化 DataGridRow 绑定数据源中每个数据项的对象。 相反, DataGrid 仅在需要时创建 DataGridRow 对象,并尽可能多地重复使用它们。 例如,为 DataGrid 当前处于视图中的每个数据项创建一个 DataGridRow 对象,并在行从视图中滚动时回收该行。

此事件使你能够在重复使用行之前对行进行任何必要的更改。 通常使用此事件来撤消在事件处理程序中 LoadingRow 所做的任何更改。

适用于

另请参阅