gpt4 book ai didi

c# - 我们如何捕获 xamDataGrid 中的行删除通知?

转载 作者:行者123 更新时间:2023-11-30 17:17:49 24 4
gpt4 key购买 nike

我们有一个 Infragistics xamDataGrid将 DataSource 绑定(bind)到 BindingList。我们通过标题在组上设置了一些自定义文本,每次添加或删除项目时都需要重置它。

DataSource 中删除项目时是否有通知时间?以便我们可以按标题更新组?插入很容易,因为它有一个 InitializeRecord event我们可以使用它来按标题刷新组。我们正在寻找删除的等效项。

请注意,BindingList 未在 GUI 中更新,因此我们无法使用 RecordsDeletingRecordsDeleted xamDataGrid 提供的事件。

最佳答案

如果数据源是 IBindingList,您可以使用与设置数据源的网格相同的事件。 : ListChanged事件。或者,如果您的数据源也实现了 INotifyCollectionChanged,您可以使用 CollectionChanged 事件。

为此,您只需在设置数据源的同一段代码中订阅事件即可。像这样的东西:

dataSource.ListChanged += DataSource_ListChanged;

您将在您的处理程序中获得此信息:

是这样描述的:

The NewIndex property indicates the index of the item that was added, changed, or deleted. If an item was moved, the NewIndex property indicates the new location of the item and the OldIndex property indicates the old location.

关于c# - 我们如何捕获 xamDataGrid 中的行删除通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6183959/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com