Devexpress LookUpEdit控件, 使用List类(自定义Class,多字段列),无法绑定列(有记录行,但都为空白行)
描述如下:1.Devexpress LookUpEdit控件,使用List类用于数据列表信息绑定,使用自定义Class,多字段列代码如下:
Public Class UserArrayList
Private VAL000 As Long
Private VAL001 As String
Private VAL002 As String
Sub New(Optional xV000 As Long = 0, Optional xV001 As String = "", Optional xV002 As String = "" )
Me.VAL000 = xV000
Me.VAL001 = xV001
Me.VAL002 = xV002
End Sub
End Class
2.窗体中有Devexpress LookUpEdit控件,数据加载代码如下:
Private Sub But_A04_Click(sender As Object, e As EventArgs) Handles But_A04.Click
Dim xList As New List(Of UserArrayList)
xList.Add(New UserArrayList(1, "王一", "男"))
xList.Add(New UserArrayList(2, "李二", "女"))
xList.Add(New UserArrayList(3, "张三", "男"))
xList.Add(New UserArrayList(4, "赵四", "女"))
LookUpEdit1.Properties.DataSource = xList
LookUpEdit1.Properties.NullText = ""
LookUpEdit1.Properties.DisplayMember = "VAL001"
LookUpEdit1.Properties.ValueMember = "VAL000"
Dim xLookupCol As DevExpress.XtraEditors.Controls.LookUpColumnInfo
xLookupCol= New DevExpress.XtraEditors.Controls.LookUpColumnInfo
xLookupCol.FieldName = "VAL000"
xLookupCol.Caption = "ID"
LookUpEdit1.Properties.Columns.Add(xLookupCol)
xLookupCol= New DevExpress.XtraEditors.Controls.LookUpColumnInfo
xLookupCol.FieldName = "VAL001"
xLookupCol.Caption = "姓名"
LookUpEdit1.Properties.Columns.Add(xLookupCol)
xLookupCol= New DevExpress.XtraEditors.Controls.LookUpColumnInfo
xLookupCol.FieldName = "VAL002"
xLookupCol.Caption = "性别"
LookUpEdit1.Properties.Columns.Add(xLookupCol)
End Sub
3.以上运行结果:【LookUpEdit1】列表中,显示4行记录,但是3列全为空白,应当未绑定成功列字段
求助,不知道哪出了问题!谢谢!