0

我将数据源表链接到控制网格:

在此处输入图像描述

并且表中的所有数据都成功显示,除了我分配给“RepositoryItemLookupEdit”以从列表中选择类型的“类型”列。如屏幕截图所示,显示的成员和值成员属性设置正确。从RepositorityItemlookupedit中选择类型后,选定的一个仍显示在网格上(选择另一个单元格时)。所以我的问题是我想在“类型”列中显示初始值。

4

1 回答 1

0

您需要处理CustomDisplayTextRepositoryItem 的

如果您的“类型”列绑定到数据对象,例如...

public class SomeType
    public property Name as string
    public property Description as string   
    public property Code as string  
End Class

您需要使用单元格的值填充DisplayText单元格的值。

Private Sub RepositoryItem_CustomDisplayText(sender As Object, e As DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs) Handles RepositoryItemLookUpEdit1.CustomDisplayText
    Try
        Dim currentSomeType = TryCast(e.Value, SomeType)
        If Not currentSomeType Is Nothing Then
            'find the correct SomeType
            Dim currentSomeTypeName As String = currentSomeType.Name
            e.DisplayText = currentSomeTypeName
        End If
    Catch exception As Exception
    End Try
End Sub
于 2014-08-06T10:03:21.430 回答