-1

I have this combobox on WPF: http://i.snag.gy/UC7EN.jpg

I want write text on the place that i marked on red text like: "choose from option" . I tried to found the correct property to edit but i didn't succeeded to put a text there.

How can i do this? i don't want tooltip or put text lable on the side of the combobox , i want text where i marked please thanks.

jordan
  • 119
  • 2
  • 3
  • 10

4 Answers4

2

You can add events DropDownOpened and DropDownClosed. On DropDownClosed you can insert "Choose from option" using comboBox.Items.Insert(0, "Choose from option") and set SelectedIndex = 0;

On DropDownOpened you can delete this item.

Or try to put TextBlock inside ComboBox.

Roman
  • 11,966
  • 10
  • 38
  • 47
1

One way to do that would be

<ComboBox Text="choose from option" IsEditable="True" IsReadOnly="True" ></ComboBox>
bit
  • 4,407
  • 1
  • 28
  • 50
0

Insert the "Choose from option" string into your items:

cb.Items.Insert(0, "Choose from option");
91378246
  • 488
  • 6
  • 14
0

What you are looking for is a watermark combobox. A very simple method has been described here How to display default text "--Select Team --" in combo box on pageload in WPF?.

Community
  • 1
  • 1
Jams
  • 79
  • 2
  • 6