private void InitializeComponent() { // // fontAwesomeIcon // fontIcon = new Icon(Pictogram.GetTypeface()) { FontSize = IconSize, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, AutoSize = true }; // // labelText // labelMessage = new Label() { FontSize = Helpers.Common.GetNamedSize(NamedSize.Small), HorizontalTextAlignment = TextAlignment.Center, FontAttributes = FontAttributes.Bold }; StackLayout StackContent = new StackLayout() { Spacing = 0, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; StackContent.Children.Add(fontIcon); StackContent.Children.Add(labelMessage); this.Children.Add(StackContent, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.SizeProportional); }
public Icon(Pictogram glyph) : this(glyph.GetTypeface()) { }
public Icon(Pictogram glyph, int type) : this(glyph.GetTypeface(), type) { }
private void InitializeComponent() { #region Styles // // styleText // Style styleText = new Style(typeof(Label)); styleText.Setters.Add(Label.TextColorProperty, TextColor); styleText.Setters.Add(Label.HorizontalOptionsProperty, LayoutOptions.FillAndExpand); styleText.Setters.Add(Label.VerticalOptionsProperty, LayoutOptions.CenterAndExpand); styleText.Setters.Add(Label.FontAttributesProperty, FontAttributes.None); styleText.Setters.Add(Label.FontSizeProperty, Helpers.Common.GetNamedSize(NamedSize.Medium)); // // styleDetail // Style styleDetail = new Style(typeof(Label)); styleDetail.Setters.Add(Label.TextColorProperty, DetailColor); styleDetail.Setters.Add(Label.HorizontalOptionsProperty, LayoutOptions.FillAndExpand); styleDetail.Setters.Add(Label.VerticalOptionsProperty, LayoutOptions.StartAndExpand); styleDetail.Setters.Add(Label.FontSizeProperty, Helpers.Common.GetNamedSize(NamedSize.Small)); #endregion Styles // // fontIcon // fontIcon = new Icon(Pictogram.GetTypeface()) { FontSize = Helpers.Common.GetNamedSize(NamedSize.Default) * 2, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.CenterAndExpand, TextColor = IconColor, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, AutoSize = true }; // // labelText // labelTitle = new Label() { Style = styleText, HorizontalTextAlignment = TextAlignment.Start, VerticalTextAlignment = TextAlignment.Center }; // // labelDetail // labelDetail = new Label() { Style = styleDetail, LineBreakMode = LineBreakMode.TailTruncation }; // // StackVertical // stackVertical = new StackLayout() { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Spacing = 0 }; stackVertical.Children.Add(labelTitle); if (!string.IsNullOrEmpty(Detail) || !ForceDetails) { labelTitle.VerticalOptions = LayoutOptions.EndAndExpand; stackVertical.Children.Add(labelDetail); } // // StackContent // StackLayout stackContent = new StackLayout() { Padding = new Thickness(10, 0), Spacing = 20, Orientation = StackOrientation.Horizontal }; stackContent.Children.Add(fontIcon); stackContent.Children.Add(stackVertical); this.View = stackContent; this.View.BackgroundColor = BackgroundColor; }