Hi team,
I have implemented a MAUI App and now I want to add sfComboBox as a dropdown.
Here my requirement is, I not only need to show normal text list as options.
I need to show some DataTemplate list as options.
For example, I want to show,
Country Name, Country Logo and Main City Name in one option from sfComboBox.
Likewise, I need to add those kind of options list to my combobox.
How do I achieve this?
Thanks!
Best Regards,
Sachith Priyashantha.
Hi Sachith,
Thank you for reaching out to Syncfusion support.
We suggest utilize ItemTemplate property in the SfComboBox to achieve your requirement. We have created a sample based on your requirement and attached it for your reference. Please review the provided sample, and don't hesitate to contact us if you require further information or clarification.
Please refer the below code snippet for this,
|
<editors:SfComboBox Placeholder="Select a Conutry" TextMemberPath="CountryName" ItemsSource="{Binding CountryCollection}"> <editors:SfComboBox.ItemTemplate> <DataTemplate > <ViewCell> <Grid Margin="10,5" ColumnDefinitions="48,*"> <Image Grid.Column="0" HorizontalOptions="Start" VerticalOptions="Center" Source="{Binding CountryLogo}" Aspect="AspectFit"/> <StackLayout HorizontalOptions="Start" VerticalOptions="Center" Grid.Column="1" Margin="15,0,0,0"> <Label HorizontalTextAlignment="Start" VerticalTextAlignment="Center" Opacity=".87" FontSize="14" Text="{Binding CountryName}"/> <Label HorizontalOptions="Start" VerticalTextAlignment="Center" Opacity=".54" FontSize="12" Text="{Binding MainCityName}"/> </StackLayout> </Grid> </ViewCell> </DataTemplate> </editors:SfComboBox.ItemTemplate> </editors:SfComboBox> |
Additionally, for more detailed information, please refer to the following help documentation:
Link : https://help.syncfusion.com/maui/combobox/ui-customization#customize-the-dropdown-suggestion-item
Regards,
Brundha V
Hi Brundha V,
It works 😍
Thanks for your support.
I have another requirement.
Assume my Combobox have 15 options.
Normally it drops down all 15 items from top to bottom.
Now I want to show these 15 items, in 3 separate columns/sections,
(By 5 options per one section.)
How can I achieve this?
Best Regards,
Sachith Priyashantha
Hi Sachith ,
After reviewing your query, we regret to inform you that displaying those 15 items in 3 separate columns/sections in the DropDown of SfComboBox in .NET MAUI is not possible.
If you have further inquiries, kindly let us know the details, and we'll be glad to assist you.
Regards,
Ahamed Ali Nishad,