我想在DotNetBar SuperDataGrid Controll中將列渲染爲組合框(更精確地作爲GridComboBoxExEditControl
)。 SuperDataGrid
連接到綁定源。 在DataBindingComplete
事件我有以下幾點:ComboBox在DotNetBar SuperDataGrid中渲染
Private Sub SuperGrid_DataBindingComplete(ByVal sender As Object, ByVal e As DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs) Handles SuperGrid.DataBindingComplete
Dim panel As DevComponents.DotNetBar.SuperGrid.GridPanel
panel = e.GridPanel
panel.Columns("ArticleID").RenderType = GetType(MyComboBox)
panel.Columns("ArticleID").RenderParams = New Object() {ArticleBindingSource, "Article", "Article"}
End Sub
而且MyComboBox類雲:
Public Class MyComboBox
Inherits GridComboBoxExEditControl
Public Sub New(ByVal Bind As BindingSource, ByVal disp As String, ByVal val As String)
DataSource = Bind
DisplayMember = disp
ValueMember = val
End Sub
End Class
這將導致以下: 的SuperDataGrid顯示在單元格中正確的價值觀。如果作爲「Article」呈現,綁定是正確的,並且「ArticleID」的每個值都是正確的。 問題是,當數值從ArticleID = 1 to ArticleID = 2
(Article =「Article No1」到Article =「Artcle No2」)變化時,SuperDataGrid進入某種形式的無限循環,並且值開始在1和2之間切換。錯誤? 如果有人能提供一些關於這個問題的建議,我將非常感激。 P.S. 我也試過這個:
panel.Columns("ArticleID").EditorType = GetType(GridComboBoxExEditControl)
Dim art As GridComboBoxExEditControl = DirectCast(panel.Columns("ArticleID").EditControl, GridComboBoxExEditControl)
art.DataSource = ArticleBindingSource
art.DisplayMember = "Article"
art.ValueMember = "ArticleID"
得到了同樣的結果。