This is a migrated thread and some comments may be shown as answers.

How to set a bound ComboBox to Nothing?

1 Answer 40 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rob Ainscough
Top achievements
Rank 1
Rob Ainscough asked on 05 Mar 2013, 08:50 PM
I have a ComboBox that is bound to an observable collection with the selectedItem set to an object in that collection.  All good.

However, there are times when I want the ComboBox to not have a selected value, so I set the object = Nothing (that is bound to SelectedItem) and this works fine, I see nothing is selected in the ComboBox.  However, what I want to do now is display a text/string value in the combobox like "Not Available".  This doesn't appear to be possible?

Using the Text property doesn't appear to do anything when the ComboBox is bound to an observable collection.

Any hints/suggestions?


1 Answer, 1 is accepted

Sort by
0
Rob Ainscough
Top achievements
Rank 1
answered on 05 Mar 2013, 08:59 PM
SOLVED:

It was very easy, use the "EmptyText" property.

Rob
Tags
ComboBox
Asked by
Rob Ainscough
Top achievements
Rank 1
Answers by
Rob Ainscough
Top achievements
Rank 1
Share this question
or