Click here to Skip to main content
15,851,711 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Combo Box, using a List as ItemSource. The First Item of the List is displayed directly in the Combo box. What i want is:
If there are more than 1 items, dropdown should be enabled (works automatically), but if there is just one item in the List, i want to display it in the combo box and disable Dropdown!
is there any possibility to do this in xaml? (Style or somthing?)

Kind Regards

This is really quite simple.

Define and IsEditable property for the dropdown.
Bind the Editable property of the dropdown to this property.

If your collection has just one row disable the dropdown by setting the property.
You need to have INOtifyPropertyChanged implemented, of course.
Share this answer
i found another way to achiev this...
IsHitTestVisible = False;
IsEditable = False;
Focusable = False;

did exactly what i want!
I made a Style in xaml with a DataTrigger, checking the Count Property of my List, and set the Properties as shown above.

Greets Moti
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900