首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >.Net:响应IBinding.ListChanged而不是CellValueChanged事件处理程序的DataGridView

.Net:响应IBinding.ListChanged而不是CellValueChanged事件处理程序的DataGridView
EN

Stack Overflow用户
提问于 2010-08-18 22:39:17
回答 1查看 534关注 0票数 2

我有一个自定义的IBinding列表,它引发ListChanged事件。我想对ListChanged事件之后的数据视图行进行重新着色。

数据视图响应ListChanged事件并更改单元格值,但从未触发CellValueChanged事件。

什么数据视图事件反映了ListChanged事件?

类CustomList : IBinding

代码语言:javascript
复制
Public Sub UpdateList(Byval index as Integer)
     List(index).Active = true
     RaiseEvent ListChanged(Me, _
        New System.ComponentModel.ListChangedEventArgs _
        (System.ComponentModel.ListChangedType.ItemChanged, index))
End Sub

类CustomDataGridView : DataGridView

代码语言:javascript
复制
Private Sub Grid_CellValueChanged(ByVal sender As Object, _
            ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _
            Handles Me.CellValueChanged
     ColorRow(Rows(e.RowIndex)) ''//NeverFires
End Sub

类:表单

代码语言:javascript
复制
Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
                Handles Me.Load

        Dim customList As New CustomList()
        customList.add(new CustomItem())
        dgv.DataSource = customList
        customList.UpdateList(0) ''//DatagridView updates but no event is raised

End Sub

更新:

只有当一个新值从DGV推送到DT时,

CellValueChanged事件才会触发。不是相反的。

- Vivek Apr 5 at 18:52

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-08-22 09:12:15

更改单元格背景色应在RowPrePaint中完成,如果在值更改后重新绘制行,这将被触发。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3517310

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档