void UnderlineText(FontLabel label) { if (label.Underline) { Control.PaintFlags = Control.PaintFlags | PaintFlags.UnderlineText; } }
View CreateContentRating() { var title = new FontLabel { Text = "Content", Font = Font.OfSize(Fonts.OpenSans, 18) }; var content = new FiveStarRatingView { HorizontalOptions = LayoutOptions.CenterAndExpand }; content.SetBinding( FiveStarRatingView.RatingValueProperty, "ContentRating", BindingMode.TwoWay ); var view = new StackLayout { Orientation = StackOrientation.Vertical, Spacing = 10, Children = { title, content } }; return(view); }
public MenuCell() { _label = new FontLabel { VerticalOptions = LayoutOptions.Center, TextColor = Color.White, FontLabelType = FontLabelType.Light, Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Thin", NamedSize.Small), Font.SystemFontOfSize(18), Font.SystemFontOfSize(40)) }; if (Device.OS == TargetPlatform.Android) { _label.SetBinding(Label.TextProperty, "Name"); } var layout = new StackLayout { BackgroundColor = App.XamDarkBlue, Padding = new Thickness(25, 5, 10, 5), Spacing = 10, Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.StartAndExpand, Children = { /*icon,*/ _label } }; if (IsWindowsPhone) { layout.Padding = new Thickness(25, 10, 10, 10); } View = layout; }
View CreateHeaderLabel() { var headerLabel = new FontLabel { TextColor = Color.FromHex("26ade6"), Font = Font.OfSize(Fonts.OpenSansBold, 12), XAlign = TextAlignment.Center }; headerLabel.SetBinding( FontLabel.TextProperty, "CaptureStats", converter: new ScavengerHuntHeaderConverter()); var headerLabelView = new StackLayout { HorizontalOptions = LayoutOptions.CenterAndExpand, Padding = new Thickness(10, 0, 10, 0), Children = { headerLabel } }; return(headerLabelView); }
View CreateGettingStartedView() { var header = new FontLabel { Text = "Getting Started", Font = Font.OfSize(Fonts.OpenSansBold, 18), HorizontalOptions = LayoutOptions.CenterAndExpand, }; var details = new FontLabel { Text = "Looks like your contact list is empty. " + "Get out there and make some connections! " + "\n(Tap the + sign to add contacts)", Font = Font.OfSize(Fonts.OpenSansLight, 14), XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.CenterAndExpand }; var view = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Padding = new Thickness(30, 5, 30, 5), // BackgroundColor = Color.Default, IsVisible = false, Children = { header, details } }; view.SetBinding(StackLayout.IsVisibleProperty, "IsEmpty"); return(view); }
public Size MeasureText(string text, FontLabel font, Position position) { using var gdiFont = font.ToGdi(); using var gdiFormat = font.TextFormat.ToGdi(); var stringSize = _graph.MeasureString(text, gdiFont, position.ToGdi(), gdiFormat); return(Gdi.Size.Ceiling(stringSize).ToVisualizer()); }
void SetUnderline(FontLabel view) { if (view.Underline) { Control.AttributedText = new NSAttributedString(Control.Text, Control.Font, Control.TextColor, underlineStyle: NSUnderlineStyle.Single); } }
View CreatePhoneLabel() { var label = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 14), Text = _contact.Phone }; return(label); }
View CreateTwitterLabel() { var label = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 14), Text = _contact.Twitter }; return(label); }
View CreateTwitterLabel() { var label = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 12) }; label.SetBinding(Label.TextProperty, "Twitter"); return(label); }
static View CreateLastName() { var label = new FontLabel { Font = Font.OfSize(Fonts.OpenSans, 18), TextColor = Colors.MenuText }; label.SetBinding(Label.TextProperty, "LastName"); return(label); }
View CreateTitleLabel() { var label = new FontLabel { Font = Font.OfSize(Fonts.OpenSansBold, 10), Text = _contact.Role + ", " + _contact.Company, HorizontalOptions = LayoutOptions.Center, }; return(label); }
View CreateTitleLabel() { var label = new FontLabel { HorizontalOptions = LayoutOptions.Center, Font = Font.OfSize(Fonts.OpenSansLight, 9) }; label.SetBinding(Label.TextProperty, "Title"); return(label); }
View CreateNameLabel() { var label = new FontLabel { HorizontalOptions = LayoutOptions.Center, Font = Font.OfSize(Fonts.OpenSans, 18) }; label.SetBinding(Label.TextProperty, "FullName"); return(label); }
private void DrawAdjustedFontString(string text, FontLabel fontLabel, Size containerSize, Action <Gdi.Font> drawAction) { var font = GetAdjustedFont(text, fontLabel, containerSize); if (font != null) { drawAction(font); font.Dispose(); } }
static FontLabel CreateNoSessionLabel() { var noSessionLabel = new FontLabel { Text = "Choose a Session", Font = Font.OfSize(Fonts.OpenSansLight, 14), TextColor = Color.FromHex("333333"), HorizontalOptions = LayoutOptions.EndAndExpand }; return(noSessionLabel); }
private void DrawByCharActivationFunction(char character, string fontfamily, Position position, Size size, ICanvas canvas) { var factor = size.Height / 5; var factorSize = factor * 2 - factor / 3; var format = new TextFormat(HorizontalAlignment.Center, VerticalAlignment.Middle, TextTrimming.None); var brush = new SolidBrush(Color.Black); var font = new FontLabel(fontfamily, FontStyle.Italic, 8, brush, format); canvas.DrawText(character.ToString(), font, new Rectangle(new Position(position.X - factor, position.Y - factor), new Size(size.Width + factorSize, size.Height + factorSize))); }
private void UpdateFont() { FontLabel myl = (FontLabel)this.Element; if (!string.IsNullOrWhiteSpace(myl.FontFile)) { var label = (TextView)Control; Typeface font = Typeface.CreateFromAsset(Xamarin.Forms.Forms.Context.Assets, string.Format("fonts/{0}", myl.FontFile.Replace("-", ""))); label.Typeface = font; } }
public void DrawText(string text, FontLabel fontLabel, Rectangle rect) { if (!Validate(fontLabel.Brush)) { return; } using var gdiBrush = fontLabel.Brush.ToGdi(rect); using var gdiFormat = fontLabel.TextFormat.ToGdi(); DrawAdjustedFontString(text, fontLabel, rect.Size, (font) => _graph.DrawString(text, font, gdiBrush, rect.ToGdi(), gdiFormat)); }
View CreateGravatarInfoLabel() { var infoLabel = new FontLabel { HorizontalOptions = LayoutOptions.StartAndExpand, Font = Font.OfSize(Fonts.OpenSansBold, 10), Text = "Profile image pulled from Gravatar using your email address", TextColor = Color.FromHex("26ade6"), WidthRequest = 200 }; return(infoLabel); }
FontLabel CreateScoreLabel() { var scoreLabel = new FontLabel { Text = "Score!", Font = Font.OfSize(Fonts.OpenSans, 18), TextColor = Color.Black, XAlign = TextAlignment.Center }; return(scoreLabel); }
FontLabel CreateHowToLabel() { var howToLabel = new FontLabel { Text = "Claim your free t-shirt \nat the registration desk", Font = Font.OfSize(Fonts.OpenSansLight, 18), TextColor = Color.FromHex("333333"), XAlign = TextAlignment.Center }; return(howToLabel); }
FontLabel CreateLabel(string message) { var label = new FontLabel { Text = message, TextColor = Color.FromHex("26ade6"), Font = Font.OfSize(Fonts.OpenSansBold, 12), HorizontalOptions = LayoutOptions.StartAndExpand }; return(label); }
/* SessionDescription: additional info about session (non-colored part) */ View CreateDescriptionLabel() { var desc = new FontLabel { LineBreakMode = LineBreakMode.WordWrap, Font = Font.OfSize(Fonts.OpenSans, 12) }; desc.SetBinding(FontLabel.TextProperty, "Abstract"); return(desc); }
View CreateBulletPoint() { var bulletPoint = new FontLabel { Text = "\u2022", YAlign = TextAlignment.Center }; bulletPoint.SetBinding(FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter()); return(bulletPoint); }
FontLabel CreateOptionLabel(string optionText) { var optionLabel = new FontLabel { Text = optionText, TextColor = Color.FromHex("333333"), Font = Font.OfSize(Fonts.OpenSansLight, 18), HorizontalOptions = LayoutOptions.EndAndExpand, YAlign = TextAlignment.Center }; return(optionLabel); }
static FontLabel CreateTimeLabel() { var timeLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 24), HorizontalOptions = LayoutOptions.EndAndExpand, VerticalOptions = LayoutOptions.EndAndExpand }; timeLabel.SetBinding(FontLabel.TextProperty, "Time", converter: new DateTimeValueConverter("h:mm")); timeLabel.SetBinding(FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter()); return(timeLabel); }
View CreateTrackLabel() { var trackLabel = new FontLabel { HorizontalOptions = LayoutOptions.CenterAndExpand, Font = Font.OfSize(Fonts.OpenSans, 9) /* NEEDS TO BE SEMI-BOLD FONT */ }; trackLabel.SetBinding(FontLabel.TextProperty, "Track", converter: new TrackValueConverter()); trackLabel.SetBinding(FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter()); return(trackLabel); }
View CreateSpeakerLabel() { var speakerLabel = new FontLabel { HorizontalOptions = LayoutOptions.CenterAndExpand, Font = Font.OfSize(Fonts.OpenSans, 12) }; speakerLabel.SetBinding(FontLabel.TextProperty, "PrimarySpeakerName"); speakerLabel.SetBinding(FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter()); return(speakerLabel); }
View CreateCompanyLabel() { var companyLabel = new FontLabel { HorizontalOptions = LayoutOptions.CenterAndExpand, Font = Font.OfSize(Fonts.OpenSansLight, 10) /* NEEDS TO BE ITALIC FONT */ }; companyLabel.SetBinding(FontLabel.TextProperty, "PrimarySpeakerCompany"); companyLabel.SetBinding(FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter()); return(companyLabel); }