Hello, in my sample code here I am using a set of Syncfusion controls, but this should apply to any controls or templates.
I want to make a ComboBox, that is comprised of another set of controls, in this case Chip controls.
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;
});
Is there some other/better way to do this? or is this not possible? (again speaking outside of any proprietary constraints. AKA is this just a syncfusion limitation and the nest should work?)
Thanks much!
Cheers!