private static View ProgressOverviewElement(string title, BindingBase countBinding, Color color, LayoutOptions alignment, string parameter) { var lblTitle = new Label() { HorizontalOptions = alignment, Text = title.ToUpper(), TextColor = Colors.TextFaded, FontSize = Sizes.TextMicro, }; var infoSize = (int)Sizes.TextMicro - 1; var info = new SvgCachedImage() { HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Start, WidthRequest = infoSize, HeightRequest = infoSize, Source = Images.HistoryInfo, }; info.ReplaceColor(Colors.TextFaded); var titleLayout = new StackLayout() { VerticalOptions = LayoutOptions.Center, Orientation = StackOrientation.Horizontal, Children = { lblTitle, info, } }; var line = DefaultView.UnderLine; line.BackgroundColor = color; line.Margin = new Thickness(0, 0, infoSize, 0); var spanMinutes = new Span() { TextColor = color, FontAttributes = FontAttributes.Bold, FontSize = Sizes.TextLarge, }; countBinding.Mode = BindingMode.OneWay; //Span default is OneTime: https://github.com/xamarin/Xamarin.Forms/issues/2177 spanMinutes.SetBinding(Span.TextProperty, countBinding); var lblCounter = new Label() { HorizontalOptions = LayoutOptions.Start, Margin = new Thickness(0, 0, infoSize, 0), FormattedText = new FormattedString() { Spans = { spanMinutes, new Span() { Text = " min", TextColor = color, FontSize = Sizes.TextLarge, } } } }; //lblCounter.SetBinding(IsVisibleProperty, nameof(HistoryViewModel.IsLoadingWalkingData)); var layout = new StackLayout() { HorizontalOptions = alignment, VerticalOptions = LayoutOptions.Center, Children = { titleLayout, line, lblCounter } }; layout.AddTouchCommand(new Binding(nameof(HistoryViewModel.OpenInfo)), parameter); return(layout); }