private void LoadImages(IReadOnlyCollection <string> images) { if (images == null || images.Count == 0) { return; } foreach (var imgS in images) { var img = ImageResourceExtension.GetEmbeddedImage(imgS); if (img != ImageResourceExtension.DefaultEmptyImage) { ImageContainer.Children.Add(new Image { Source = img }); } } }
public SvButton(string name, string text = "", Action <object, EventArgs> action = null, string icon = "circle.png", IDictionary <string, ViewComponent> uc = null) : base(ViewComponentType.Button, name) { _action = action; if (string.IsNullOrWhiteSpace(icon)) { icon = "circle.png"; } var iS = ImageResourceExtension.GetEmbeddedImage("AiRTech.Core.Resources." + icon); var i = new CircleImage { BorderColor = Color.White, BorderThickness = 3, HeightRequest = 100, WidthRequest = 100, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Source = iS }; Button = new Button { Text = text, TextColor = Color.White, BackgroundColor = Color.Transparent, BorderColor = Color.Transparent, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; if (_action != null) { Button.Clicked += OnAction; } var s = new AbsoluteLayout(); s.Children.Add(i, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All); s.Children.Add(Button, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All); Source = s; uc?.Add(name, this); }