Set hint or watermark or default text for ComboBox without adding it as item

前端 未结 3 1633
离开以前
离开以前 2020-12-04 03:46

So, I\'m trying to put some text showing up on the ComboBox before it has a selection made by the user.

That text should not be an item, selectable by t

3条回答
  •  被撕碎了的回忆
    2020-12-04 04:15

    You can simply set a String to the Text property of that Combobox. This will give you the desired behaviour. Keep in mind that your code must take into account that this combo may have not any item selected. You can check this by the SelectedIndex property that will be -1.

提交回复
热议问题