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; }
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; }
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 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 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 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; }
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); }
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 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 CreateTwitterLabel () { var label = new FontLabel { Font = Font.OfSize(Fonts.OpenSansLight, 12) }; label.SetBinding (Label.TextProperty, "Twitter"); return label; }
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; }
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 } }; }
static FontLabel CreateAMPMLabel () { var amPMLabel = new FontLabel { Font = Font.OfSize(Fonts.OpenSansBold, 9), HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.EndAndExpand, YAlign = TextAlignment.End, TranslationY = -4 }; amPMLabel.SetBinding (FontLabel.TextProperty, "Time", converter: new DateTimeValueConverter ("tt")); amPMLabel.SetBinding (FontLabel.TextColorProperty, "Track", converter: new TrackTextColorConverter ()); return amPMLabel; }
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 CreateTitleLabel () { var label = new FontLabel { HorizontalOptions = LayoutOptions.Center, Font = Font.OfSize(Fonts.OpenSansLight, 9) }; label.SetBinding (Label.TextProperty, "Title"); 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; }
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 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; }
View CreateNameLabel () { var label = new FontLabel { HorizontalOptions = LayoutOptions.Center, Font = Font.OfSize(Fonts.OpenSans, 18) }; label.SetBinding (Label.TextProperty, "FullName"); return label; }