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 DayHeader () { HorizontalOptions = LayoutOptions.Center; var dayLabel = new FontLabel { TextColor = Color.FromHex("ea2228"), Font = Font.OfSize(Fonts.OpenSansBold, 12) }; dayLabel.SetBinding (Label.TextProperty, "Date", converter: new DateTimeValueConverter ("dddd", true)); var dateLabel = new Label { TextColor = Color.FromHex("ea2228"), Font = Font.OfSize(Fonts.OpenSansLight, 12) }; dateLabel.SetBinding (Label.TextProperty, "Date", converter: new DateTimeValueConverter("MMM d", true)); var dateStack = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center, Spacing = 3, Children = { dayLabel, dateLabel } }; Content = dateStack; }
public DayHeader() { HorizontalOptions = LayoutOptions.Center; var dayLabel = new FontLabel { TextColor = Color.FromHex("ea2228"), Font = Font.OfSize(Fonts.OpenSansBold, 12) }; dayLabel.SetBinding(Label.TextProperty, "Date", converter: new DateTimeValueConverter("dddd", true)); var dateLabel = new Label { TextColor = Color.FromHex("ea2228"), Font = Font.OfSize(Fonts.OpenSansLight, 12) }; dateLabel.SetBinding(Label.TextProperty, "Date", converter: new DateTimeValueConverter("MMM d", true)); var dateStack = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center, Spacing = 3, Children = { dayLabel, dateLabel } }; Content = dateStack; }
static FontLabel CreateTitleLabel () { var titleLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 14), LineBreakMode = LineBreakMode.WordWrap }; titleLabel.SetBinding (FontLabel.TextProperty, "Title"); titleLabel.SetBinding (FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter ()); return titleLabel; }
static FontLabel CreateLocationLabel () { var locationLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansBold, 9), HorizontalOptions = LayoutOptions.StartAndExpand, YAlign = TextAlignment.Center }; locationLabel.SetBinding (FontLabel.TextProperty, "Location", converter: new ToUpperValueConverter()); locationLabel.SetBinding (FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter ()); return locationLabel; }
static FontLabel CreateTrackLabel () { var trackLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 9), HorizontalOptions = LayoutOptions.EndAndExpand, YAlign = TextAlignment.Center }; trackLabel.SetBinding (FontLabel.TextProperty, "Track", converter: new TrackValueConverter()); trackLabel.SetBinding (FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter ()); return trackLabel; }
static FontLabel CreateLabel () { var label = new FontLabel { TextColor = Colors.MenuText, XAlign = TextAlignment.Start, YAlign = TextAlignment.Center, VerticalOptions = LayoutOptions.CenterAndExpand, Font = Font.OfSize (Fonts.OpenSansLight, 18) }; label.SetBinding (Label.TextProperty, "Text"); return label; }
static FontLabel CreateTitleLabel() { var titleLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 14), LineBreakMode = LineBreakMode.WordWrap }; titleLabel.SetBinding(FontLabel.TextProperty, "Title"); titleLabel.SetBinding(FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter()); return(titleLabel); }
static FontLabel CreateTrackLabel() { var trackLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 9), HorizontalOptions = LayoutOptions.EndAndExpand, YAlign = TextAlignment.Center }; trackLabel.SetBinding(FontLabel.TextProperty, "Track", converter: new TrackValueConverter()); trackLabel.SetBinding(FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter()); return(trackLabel); }
View CreateScavengerHuntDescription () { var huntDescription = new FontLabel { TextColor = Color.FromHex ("333333"), Font = Font.OfSize(Fonts.OpenSansLight, 18), WidthRequest = 250, YAlign = TextAlignment.Center }; huntDescription.SetBinding (FontLabel.TextProperty, "HuntItemDescription"); return huntDescription; }
static FontLabel CreateLocationLabel() { var locationLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansBold, 9), HorizontalOptions = LayoutOptions.StartAndExpand, YAlign = TextAlignment.Center }; locationLabel.SetBinding(FontLabel.TextProperty, "Location", converter: new ToUpperValueConverter()); locationLabel.SetBinding(FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter()); return(locationLabel); }
static FontLabel CreateLabel() { var label = new FontLabel { TextColor = Colors.MenuText, XAlign = TextAlignment.Start, YAlign = TextAlignment.Center, VerticalOptions = LayoutOptions.CenterAndExpand, Font = Font.OfSize(Fonts.OpenSansLight, 18) }; label.SetBinding(Label.TextProperty, "Text"); return(label); }
View CreateSyncingLabel() { var syncing = new FontLabel { Text = "Syncing...", TextColor = Color.FromHex("34aadc"), Font = Font.OfSize(Fonts.OpenSansBold, 10), XAlign = TextAlignment.Center }; syncing.SetBinding(FontLabel.IsVisibleProperty, "IsProxy"); return(syncing); }
public MenuCell () { _label = CreateLabel (); var content = new ContentView { BackgroundColor = Colors.MenuBackground, Padding = new Thickness (20, 0), Content = _label }; content.GestureRecognizers.Add (CreateTapGestureRecognizer ()); View = content; }
public MenuCell() { _label = CreateLabel(); var content = new ContentView { BackgroundColor = Colors.MenuBackground, Padding = new Thickness(20, 0), Content = _label }; content.GestureRecognizers.Add(CreateTapGestureRecognizer()); View = content; }
View CreateSelectionIndicator () { var selectionIndicator = new FontLabel { Font = Font.OfSize (Fonts.OpenSansLight, 24), HorizontalOptions = LayoutOptions.EndAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, WidthRequest = 25, HeightRequest = 25 }; selectionIndicator.SetBinding (FontLabel.TextProperty, "IsSelected", converter: new BooleanToTextValueConverter ("✓", "○")); selectionIndicator.SetBinding (FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter ()); return selectionIndicator; }
public ContactHeaderCell() { this.Height = 25; var title = new FontLabel { Font = Font.OfSize(Fonts.OpenSansBold, 17), VerticalOptions = LayoutOptions.Center }; title.SetBinding(Label.TextProperty, "Key"); View = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 25, BackgroundColor = Color.Default, Padding = new Thickness(5, 0, 0 , 0), Orientation = StackOrientation.Horizontal, Children = { title } }; }
public FullScheduleHeaderCell() { this.Height = 20; var title = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 12), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand }; title.SetBinding (Label.TextProperty, "StartTime", converter: new DateTimeValueConverter ("h:mm tt")); View = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, HeightRequest = 20, BackgroundColor = Color.Default, Children = { title } }; }
View CreateTimeOutView () { var header = new FontLabel { Text = "Unfortunate", Font = Font.OfSize (Fonts.OpenSans, 16), XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.CenterAndExpand, }; var timeout = new FontLabel { Text = "We're sorry. We were unable to retrieve any Tweets at this time.", Font = Font.OfSize(Fonts.OpenSansLight, 14), XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.CenterAndExpand, }; var content = new StackLayout { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, TranslationY = -20, Children = { header, timeout } }; var timeOutView = new StackLayout { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Padding = new Thickness(40, 0, 40, 0), BackgroundColor = Color.Default, Children = { content } }; timeOutView.SetBinding(Label.IsVisibleProperty, "TimedOut"); return timeOutView; }
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 CreateNeedLabel () { var needLabel = new FontLabel { Text = "What you need", TextColor = Color.FromHex ("333333"), Font = Font.OfSize (Fonts.OpenSansLight, 20), XAlign = TextAlignment.Center }; // extra layout because text wasn't centered after // returning from taking a picture var needLabelView = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.CenterAndExpand, Children = { needLabel } }; return needLabelView; }
View CreateTwitterLabel () { var label = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 12) }; label.SetBinding (Label.TextProperty, "Twitter"); return label; }
View CreateDescriptionLabel () { var descriptionLabel = new FontLabel { Text = HuntItem.ItemDescription, TextColor = Color.FromHex ("26ade6"), Font = Font.OfSize (Fonts.OpenSansBold, 12), XAlign = TextAlignment.Center }; // extra layout because text wasn't centered after // returning from taking a picture var descriptionLabelView = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.CenterAndExpand, Children = { descriptionLabel } }; return descriptionLabelView; }
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; }
View CreateNameLabel () { var label = new FontLabel { HorizontalOptions = LayoutOptions.Center, Font = Font.OfSize(Fonts.OpenSans, 18) }; label.SetBinding (Label.TextProperty, "FullName"); return label; }
View CreateLastNameStack() { var title = new FontLabel { Text = "Last Name", Font = Font.OfSize(Fonts.OpenSansBold, 10), TextColor = Color.FromHex("26ade6") }; // to add padding to labels above fields var view = new ContentView { Padding = new Thickness(7, 0, 0, 0), Content = title }; var stack = new StackLayout (); stack.Spacing = 0; stack.HorizontalOptions = LayoutOptions.FillAndExpand; stack.Children.Add (view); stack.Children.Add (CreateLastNameEntry ()); return stack; }
View CreateTitleLabel () { var label = new FontLabel { HorizontalOptions = LayoutOptions.Center, Font = Font.OfSize(Fonts.OpenSansLight, 9) }; label.SetBinding (Label.TextProperty, "Title"); return label; }
View CreateTwitterStack () { var title = new FontLabel { Text = "twitter", Font = Font.OfSize(Fonts.OpenSans, 12), TextColor = Color.FromHex("26ade6") }; var stack = new StackLayout (); stack.Spacing = 0; stack.Children.Add (title); stack.Children.Add (CreateTwitterLabel ()); return stack; }
public ContactCell() { var contactImage = new RoundedImageView { HeightRequest = 60, WidthRequest = 60, }; contactImage.SetBinding(Image.SourceProperty, "ImageUri"); contactImage.SetBinding(Image.OpacityProperty, "IsProxy", converter: new BooleanToAlphaConverter(0.5, 1.0)); var contactImageView = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Children = { contactImage } }; var firstNameLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 18) }; firstNameLabel.SetBinding(Label.TextProperty, "First"); var lastNameLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSans, 18) }; lastNameLabel.SetBinding(Label.TextProperty, "Last"); var companyLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansBold, 9) }; companyLabel.SetBinding(Label.TextProperty, "Company", converter: new ToUpperValueConverter()); companyLabel.SetBinding(FontLabel.IsVisibleProperty, "IsProxy", converter: new NegateValueConverter()); /* * * * Contact Proxy Label * * * */ var syncing = CreateSyncingLabel(); /* * * * * * * * * * * * * * * * * */ var nameStack = new StackLayout { Orientation = StackOrientation.Horizontal, Spacing = 3, Children = { firstNameLabel, lastNameLabel } }; var labelGrid = new Grid { Children = { companyLabel, syncing } }; var contactInfo = new StackLayout { Padding = new Thickness(0, 5, 0, 5), Spacing = 2, Children = { nameStack, labelGrid } }; View = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.Default, Padding = new Thickness(5, 5, 0, 5), Spacing = 10, Children = { contactImageView, contactInfo } }; }
public TwitterCell() { RelativeLayout relativelayout = new RelativeLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; /* Twitter Image */ var image = new Image (); image.SetBinding (Image.SourceProperty, new Binding ("Icon")); image.WidthRequest = image.HeightRequest = 50; relativelayout.Children.Add (image, Constraint.Constant (15), Constraint.RelativeToParent ((parent) => { return parent.Y + 15; }) ); /* * * * * * * * */ /* Twitter Name Label */ var twitterNameLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansBold, 12), YAlign = TextAlignment.End }; twitterNameLabel.SetBinding (FontLabel.TextProperty, "Name"); relativelayout.Children.Add (twitterNameLabel, Constraint.RelativeToView (image, (parent,sibling) => { return sibling.X + sibling.Width + 10; }), Constraint.RelativeToView (image, (parent,sibling) => { return sibling.Y; }) ); /* * * * * * * * * * * */ /* Twitter Handle Label */ var twitterHandleLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 10), YAlign = TextAlignment.End }; twitterHandleLabel.SetBinding(FontLabel.TextProperty, "Twitter"); relativelayout.Children.Add (twitterHandleLabel, Constraint.RelativeToView (twitterNameLabel, (parent, sibling) => { return sibling.X + sibling.Width + 5;}), Constraint.RelativeToView (twitterNameLabel, (parent, sibling) => { return sibling.Y; }), null, Constraint.RelativeToView (twitterNameLabel, (parent,sibling) => { return sibling.Height; }) ); /* * * * * * * * * * * * */ /* Time Label */ var timeLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 10), XAlign = TextAlignment.End, YAlign = TextAlignment.End, }; timeLabel.SetBinding(FontLabel.TextProperty, "Time"); relativelayout.Children.Add (timeLabel, Constraint.RelativeToView (twitterHandleLabel, (parent, sibling) => { return sibling.X + sibling.Width; }), Constraint.RelativeToView (twitterHandleLabel, (parent, sibling) => { return sibling.Y; }), Constraint.RelativeToParent ((parent) => { return parent.Width - twitterHandleLabel.Width - twitterNameLabel.Width - image.Width - 40; }), Constraint.RelativeToView (twitterHandleLabel, (parent,sibling) => { return sibling.Height; }) ); /* * * * * * */ /* Content Label */ var contentLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSans, 12) }; contentLabel.SetBinding(FontLabel.TextProperty, "Content"); Constraint contentHeightConstraint; if (Device.OS == TargetPlatform.iOS) { contentHeightConstraint = Constraint.RelativeToParent ((parent) => { return parent.Height - 20; }); } else { contentHeightConstraint = null; } relativelayout.Children.Add(contentLabel, Constraint.RelativeToView (image, (parent, sibling) => { return sibling.X + sibling.Width + 10; }), Constraint.RelativeToView (twitterNameLabel,(parent, sibling) => { return sibling.Y + sibling.Height; }), Constraint.RelativeToParent ((parent) => { return parent.Width - image.Width - 35; }), contentHeightConstraint ); /* * * * * * * * * */ relativelayout.GestureRecognizers.Add (CreateTapGestureRecognizer ()); View = relativelayout; }
View CreateSyncingLabel () { var syncing = new FontLabel { Text = "Syncing...", TextColor = Color.FromHex ("34aadc"), Font = Font.OfSize(Fonts.OpenSansBold, 10), XAlign = TextAlignment.Center }; syncing.SetBinding (FontLabel.IsVisibleProperty, "IsProxy"); return syncing; }
FontLabel CreateScoreLabel () { var scoreLabel = new FontLabel { Text = "Score!", Font = Font.OfSize(Fonts.OpenSans, 18), TextColor = Color.Black, XAlign = TextAlignment.Center }; return scoreLabel; }
void UnderlineText (FontLabel label) { if(label.Underline) Control.PaintFlags = Control.PaintFlags | PaintFlags.UnderlineText; }
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 ContactCell () { var contactImage = new RoundedImageView { HeightRequest = 60, WidthRequest = 60, }; contactImage.SetBinding (Image.SourceProperty, "ImageUri"); contactImage.SetBinding (Image.OpacityProperty, "IsProxy", converter: new BooleanToAlphaConverter (0.5, 1.0)); var contactImageView = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Children = { contactImage } }; var firstNameLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 18) }; firstNameLabel.SetBinding (Label.TextProperty, "First"); var lastNameLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSans, 18) }; lastNameLabel.SetBinding (Label.TextProperty, "Last"); var companyLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansBold, 9) }; companyLabel.SetBinding (Label.TextProperty, "Company", converter: new ToUpperValueConverter()); companyLabel.SetBinding (FontLabel.IsVisibleProperty, "IsProxy", converter: new NegateValueConverter ()); /* * * * Contact Proxy Label * * * */ var syncing = CreateSyncingLabel (); /* * * * * * * * * * * * * * * * * */ var nameStack = new StackLayout { Orientation = StackOrientation.Horizontal, Spacing = 3, Children = { firstNameLabel, lastNameLabel } }; var labelGrid = new Grid { Children = { companyLabel, syncing } }; var contactInfo = new StackLayout { Padding = new Thickness(0, 5, 0, 5), Spacing = 2, Children = { nameStack, labelGrid } }; View = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.Default, Padding = new Thickness(5, 5, 0, 5), Spacing = 10, Children = { contactImageView, contactInfo } }; }
View CreateTwitterStack () { var title = new FontLabel { Text = "Twitter", Font = Font.OfSize(Fonts.OpenSansBold, 10), TextColor = Color.FromHex("26ade6") }; // to add padding to labels above fields var view = new ContentView { Padding = new Thickness(7, 0, 0, 0), Content = title }; var stack = new StackLayout (); stack.Spacing = 0; stack.Children.Add (view); stack.Children.Add (CreateTwitterEntry ()); return stack; }
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; }