我有一个自定义的IBinding列表,它引发ListChanged事件。我想对ListChanged事件之后的数据视图行进行重新着色。
数据视图响应ListChanged事件并更改单元格值,但从未触发CellValueChanged事件。
什么数据视图事件反映了ListChanged事件?
类CustomList : IBinding
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
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类:表单
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事件才会触发。不是相反的。
发布于 2010-08-22 09:12:15
更改单元格背景色应在RowPrePaint中完成,如果在值更改后重新绘制行,这将被触发。
https://stackoverflow.com/questions/3517310
复制相似问题