I have a combo box that displays a list of values the user can chose from or they can enter their own reason. The combo box drop down is populated from a table that the users can maintain.
<ComboBox IsReadOnly="False" IsEditable="true" SelectedValue="{Binding Description}" DisplayMemberPath="Description" SelectedValuePath="Description" ItemsSource="{Binding Descriptions}"/>
Nothing too exciting here.
But sometimes the table is empty. Then we want the users to be able to enter text but they have nothing to chose from. When they drop the dropdown it looks nasty. Like this...
Combo box with a zero row itemssource |
If I disable the combo box to prevent them dropping it then they can't enter a value either. The solution is to set MaxDropDownHeight = 0 either in code or using a converter. Then when the user tries to drop the dropdown nothing happens. Like this...
Same combo box with MaxDropdownHeight = 0 |
No comments:
Post a Comment