How to display a different value for dropdown list values/selected item in a WPF ComboBox?

后端 未结 5 1037
长情又很酷
长情又很酷 2020-11-29 08:22

I have a WPF combobox bound to a list of items with long descriptions.

The type bound to the ComboBox has both short and long description as properties. Currently, I

5条回答
  •  时光取名叫无心
    2020-11-29 09:10

    Another option I have found is to place a textbox over the combobox text area. Size and align it so that it lays perfectly over it then use a sub similar to this:

    Private Sub ComboBox*_Change()
    Dim T As String
    T = Left(ComboBox*.Text, 1)
    TextBox*.Value = T
    End Sub
    

    (replace the * with the relevant numbers) the result is that when selected the dropdown will display the list as usual but the textbox lying over it will only show its first character.

    Hope this helps.

提交回复
热议问题