Height of items in SfComboBox

How do I reduce either the distance between items in a SfComboBox when its dropdown is open, or reduce the height of each item?

Using Padding has no effect


1 Reply

BV Brundha Velusamy Syncfusion Team July 20, 2023 07:28 AM UTC

Hi Paul,


Currently, we don't have support to change the height of each item and spacing of items present in SfCombobox dropdown. But we can adjust the common height of the dropdown items using ComboBox Itemtemplate property. We suggest you to set the height for the layout, which is used inside the DataTemplate. We have created a sample by using ItemTemplate and  attached the sample for your reference.


Please refer to the below code snippet for this


Code Snippet:

<inputs:SfComboBox.ItemTemplate>

                <DataTemplate >

                    <ViewCell>

                        <StackLayout HorizontalOptions="StartAndExpand"

                                     Margin="15"

                                     HeightRequest="20"

                                     VerticalOptions="CenterAndExpand">

                            <Label HorizontalTextAlignment="Start"

                                   VerticalTextAlignment="Center"

                                   Opacity=".87"

                                   FontSize="14"

                                   Text="{Binding Name}"/>

                            <Label HorizontalOptions="Start"

                                   VerticalTextAlignment="Center"

                                   Opacity=".54"

                                   FontSize="12"

                                   Text="{Binding Designation}"/>

                        </StackLayout>

                    </ViewCell>

                </DataTemplate>

            </inputs:SfComboBox.ItemTemplate>


Please take a look at the provided sample and let us know if you need any other details. 


Regards,

Brundha V.


Attachment: ComboBoxItemHeight_414bebbb.zip

Loader.
Up arrow icon