Dropdown should show only the display member

前端 未结 3 1524
情歌与酒
情歌与酒 2021-01-19 08:43

I have bound a collection to ultracombo and I have specified the value member and display member. The collections have many columns, N

3条回答
  •  盖世英雄少女心
    2021-01-19 08:57

    Here is an extension method that will hide all columns besides the DisplayMember column.

    
    Public Sub ShowOnlyDisplayMemberColumn(this As UltraCombo)
        Dim columnName As String = this.DisplayMember
        For Each band As UltraGridBand In this.DisplayLayout.Bands
            For i As Integer = 0 To band.Columns.Count - 1
                Dim column As UltraGridColumn = band.Columns(i)
                If (column.Key = columnName) Then
                    column.Hidden = False
                    column.Width = this.Width
                Else
                    column.Hidden = True
                End If
            Next
        Next
    End Sub
    

提交回复
热议问题