using Billing.Themes; using System.Collections; using Xamarin.Forms; namespace Billing.UI { public class ItemSelectPage : ContentPage { public ItemSelectPage(IList source) { Content = new ListView { ItemsSource = source, ItemTemplate = new DataTemplate(() => new StackLayout { Orientation = StackOrientation.Horizontal, Padding = new Thickness(20, 0), Spacing = 10, Children = { new Image { WidthRequest = 22, HeightRequest = 22, Aspect = Aspect.AspectFit, VerticalOptions = LayoutOptions.Center } .Binding(Image.SourceProperty, "Icon"), new Label { VerticalOptions = LayoutOptions.Center, LineBreakMode = LineBreakMode.TailTruncation } .Binding(Label.TextProperty, "Name") .DynamicResource(Label.TextColorProperty, BaseTheme.TextColor) } }) } .DynamicResource(BackgroundColorProperty, BaseTheme.WindowBackgroundColor); } } public class SelectItem { public string Icon { get; set; } public T Value { get; set; } public string Name { get; set; } } }