我们有一个 Infragistics xamDataGrid,数据源绑定到 BindingList。我们在分组标题上设置了一些自定义文本,每次添加或删除项目时都需要重置它。
在 DataSource 这样我们就可以按标题更新组?插入很容易,因为它有 InitializeRecord我们可以使用事件来按标题刷新组。我们正在寻找删除的等效项。
请注意,BindingList 未在 GUI 中更新,因此我们无法使用 记录删除 和 RecordsDeleted 事件。
We have a Infragistics xamDataGrid with the DataSource bound to a BindingList. We have some custom text set on the group by header and need to reset it every time an item is added or deleted.
Is there a when to be notified when an item is deleted in the DataSource so that we can update the group by header? The insertion is easy as it has a InitializeRecord event which we can use to refresh the group by header. We're looking for an equivalent for deletion.
Just to note, the BindingList is NOT updated in the GUI so we cannot use the RecordsDeleting and RecordsDeleted events offered by xamDataGrid.
发布评论
评论(1)
如果数据源是
IBindingList
:ListChanged
事件。或者,如果您的数据源也实现了INotifyCollectionChanged
,您可以使用CollectionChanged
事件。为此,您只需在设置数据源的同一代码段中订阅事件即可。类似于:
您将在处理程序中获得以下信息:
的描述如下:
You can use the same event that the grid you are setting the data source to uses if the data source is an
IBindingList
: theListChanged
event. Alternatively if your data source also implementsINotifyCollectionChanged
you can use theCollectionChanged
event.To do this you just subscribe to the event in the same section of code that sets the data source. Something like:
and you'll get this info in your handler:
which is described like this: