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

How to show dropdown when item list is empty

1 Answer 331 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Pathru
Top achievements
Rank 1
Pathru asked on 11 Jul 2013, 06:26 PM

The RedComboBox displaying list of items for selection and this list will be empty to start with. If this list is empty, user should see an empty drop down so that the User knows there is nothing to select. With my code below, I just see a small 2 pixel line below combo, this give an impression to user that something is wrong with application. If you use windows provided ComboBox then it will a empty dropdown and we want the same behavior from RedComboBox.

How can I enable dropdown even if there are no items in the list?


<RadComboBox
   HorizontalAlignment="Left"
   Margin="1,1,0,1"
   VerticalAlignment="Center"
   Name="comboname" 
   SelectedItem="{Binding Path=Item, Mode=TwoWay}"
   ItemsSource="{Binding Path= ItemList}"
   IsReadOnly="False"
   EmptyText=" - select an item - "/>

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 16 Jul 2013, 02:41 PM
Hi Pathru,

What you can do is set a min height suitable for you to the Popup that opens and so when it opens it would stay as big as you need. I have attached a simple project showing how you can edit the template of the RadComboBox and set the MinHeight:
<Popup x:Name="PART_Popup">
                                <Grid x:Name="PopupRoot" MinHeight="150">
                                    <Border x:Name="PART_ResizeBorder".......
.....

Please note that this style will be applied only to the given ComboBox and if you need to add it to all ComboBoxes you can use implicit styles. Also you need to know that it will work only for non editable ComboBoxes as there are two templates - one for editable ComboBox and on for not editable. So if you want to apply it to editable ComboBoxes you just need to set MinHeight in the template the same popup which is under the "EditableTemplate":
<Setter Property="EditableTemplate">
.......
<Popup x:Name="PART_Popup">
                                <Grid x:Name="PopupRoot">

If you have any other questions, please don't hesitate to contact us.


Regards,
Georgi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ComboBox
Asked by
Pathru
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or