protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (Control is null || Element is null) { return; } if (e.PropertyName == VisualElement.HeightProperty.PropertyName || e.PropertyName == VisualElement.WidthProperty.PropertyName || e.PropertyName == IconAwesomeLabelBase.IconProperty.PropertyName || e.PropertyName == IconAwesomeLabelBase.TextProperty.PropertyName || e.PropertyName == IconAwesomeLabelBase.TypeIconProperty.PropertyName) { if (!string.IsNullOrEmpty(((IconAwesomeLabelBase)Element).Icon)) { Control.Font = UIFont.FromName(IconExtensions.FindNameForFont (((IconAwesomeLabelBase)Element).TypeIcon), (nfloat)Element.FontSize); IIcon icon = IconExtensions.FindIconForKey(((IconAwesomeLabelBase)Element).Icon); Control.Text = $"{icon.Character}"; } } }
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (Control is null || Element is null) { return; } if (e.PropertyName == VisualElement.HeightProperty.PropertyName || e.PropertyName == VisualElement.WidthProperty.PropertyName || e.PropertyName == IconAwesomeButtonBase.BorderColorProperty.PropertyName || e.PropertyName == IconAwesomeButtonBase.BorderThicknessProperty.PropertyName || e.PropertyName == IconAwesomeButtonBase.IconProperty.PropertyName || e.PropertyName == IconAwesomeButtonBase.TextProperty.PropertyName || e.PropertyName == IconAwesomeButtonBase.TypeIconProperty.PropertyName) { CreateCircle(); if (!String.IsNullOrEmpty(((IconAwesomeButtonBase)Element).Icon)) { Control.Font = UIFont.FromName(IconExtensions.FindNameForFont (((IconAwesomeButtonBase)Element).TypeIcon), (nfloat)Element.FontSize); IIcon icon = IconExtensions.FindIconForKey(((IconAwesomeButtonBase)Element).Icon); Control.SetTitle($"{icon.Character}", UIControlState.Normal); } else { Control.Font = Font.OfSize(Element.FontFamily, Element.FontSize).WithAttributes(Element.FontAttributes).ToUIFont(); Control.TitleLabel.LineBreakMode = UILineBreakMode.WordWrap; Control.TitleLabel.TextAlignment = UITextAlignment.Center; Control.SetTitle(((IconAwesomeButtonBase)Element).Text, UIControlState.Normal); } } }