I have a need for a control of a sfComboBox that use sfChips as it's elements.
Here is my sample code.
Supplies.DataSource = viewModel.SuppliesList;
Supplies.ItemTemplate = new DataTemplate(() =>
{
SfChip chip = new SfChip();
chip.ControlTemplate = new ControlTemplate(() =>
{
StackLayout sl = new StackLayout() { Orientation = StackOrientation.Horizontal };
var optionIcon = new Image { HeightRequest = 20, WidthRequest = 20, HorizontalOptions = LayoutOptions.Start, };
optionIcon.SetBinding(Image.SourceProperty, "Image");
var displayName = new Label { VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Start, Style = (Style)Application.Current.Resources["DataLabel"] };
displayName.SetBinding(Label.TextProperty, "Name");
sl.Children.Add(optionIcon);
sl.Children.Add(displayName);
return sl;
});
return chip;
});
When I run this code, I get a sfComboBox that has the proper number of elements, that are just blank sfChips.
Any ideas or suggestions?
Thanks!