public OnboardingWelcomeView() { ScreenHeight = App.ScreenHeight; var icShoe = new SvgCachedImage() { HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, Aspect = Aspect.AspectFit, HeightRequest = 64, Source = Images.OnboardingShoe, }; var lblWelcomeText = new Label() { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Center, FontSize = Sizes.Title, FormattedText = new FormattedString() { Spans = { new Span() { Text = AppText.onboarding_first_title + "\n", FontSize = Sizes.Title, }, new Span() { Text = AppText.onboarding_first_text, FontAttributes = FontAttributes.Bold, FontSize = Sizes.TextLarge, }, } }, }; var lblNameTitle = new Label() { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Center, FontAttributes = FontAttributes.Bold, Text = AppText.onboarding_entry_title, FontSize = Sizes.Title, }; var entry = new Entry() { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Center, TextColor = Colors.TextSpecial, FontAttributes = FontAttributes.Bold, FontSize = Sizes.TextLarge, Keyboard = Keyboard.Text, IsTextPredictionEnabled = false, Margin = 0, }; entry.SetBinding(Entry.TextProperty, nameof(ViewModel.UserName)); entry.SetBinding(Entry.ReturnCommandProperty, nameof(ViewModel.NextClickedCommand)); var nextArrow = new SvgCachedImage() { HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, HeightRequest = Sizes.TextSmall - 2, Aspect = Aspect.AspectFit, Source = Images.ToolbarArrow, Margin = new Thickness(-10f, -10f, 0, -10f), }; nextArrow.ReplaceColor(Colors.TextSpecial); nextArrow.SetBinding(IsVisibleProperty, nameof(ViewModel.IsValid)); nextArrow.AddTouchCommand(new Binding(nameof(ViewModel.NextClickedCommand))); var line = new BorderCanvasView() { Border = new Thickness(0, 0, 0, 1), BorderColor = Colors.LightBorderColor.MultiplyAlpha(0.5), InputTransparent = true, }; var entryContainer = new Grid() { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Center, Margin = new Thickness(0, 20), RowSpacing = 10, RowDefinitions = new RowDefinitionCollection() { new RowDefinition() { Height = GridLength.Auto }, new RowDefinition() { Height = GridLength.Auto }, }, ColumnDefinitions = new ColumnDefinitionCollection() { new ColumnDefinition() { Width = GridLength.Star }, new ColumnDefinition() { Width = 40 }, }, Children = { { line, 0, 2, 1, 2 }, { lblNameTitle, 0,0 }, { entry, 0,1 }, { nextArrow, 1,1 }, } }; entry.Focused += (sender, args) => { icShoe.FadeTo(0); lblWelcomeText.FadeTo(0); entryContainer.TranslateTo(0, -120); entryContainer.RowSpacing = 40; }; entry.Unfocused += (sender, args) => { icShoe.FadeTo(1, 400, Easing.CubicIn); lblWelcomeText.FadeTo(1, 400, Easing.CubicIn); entryContainer.TranslateTo(0, 0); entryContainer.RowSpacing = 10; }; Content.Spacing = 20; AddAnimatedView(icShoe); AddAnimatedView(lblWelcomeText); AddAnimatedView(entryContainer); }
private View HeightPicker() { View picker; if (Device.RuntimePlatform == Device.Android) { var entry = new Entry() { HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.End, TextColor = Colors.Text, BackgroundColor = Color.Transparent, Keyboard = Keyboard.Numeric, MaxLength = 3, Placeholder = "165", PlaceholderColor = Color.White.MultiplyAlpha(0.8f), }; entry.SetBinding(Entry.TextProperty, nameof(ViewModel.HeightText), BindingMode.TwoWay); var lbl = new Label() { HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, Text = "cm", }; picker = new StackLayout() { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Orientation = StackOrientation.Horizontal, Children = { entry, lbl, } }; } else { var iospicker = new Picker() { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Center, TextColor = Colors.Text, Title = "Høyde", BackgroundColor = Color.Transparent, }; iospicker.SetBinding(Picker.SelectedIndexProperty, nameof(ViewModel.SelectedIndex), BindingMode.TwoWay); foreach (var h in OnboardingHeightViewModel.Heights) { iospicker.Items.Add($"{h}cm"); } picker = iospicker; } var border = new BorderCanvasView() { Border = new Thickness(0, 1, 0, 1), BorderColor = Colors.LightBorderColor.MultiplyAlpha(0.5), InputTransparent = true, }; return(new Grid() { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Center, Children = { border, picker, } }); }
public AchievementListItemViewCell() { var border = new BorderCanvasView(false) { Border = new Thickness(0, 1, 0, 0), BorderColor = Colors.LightBorderColor.MultiplyAlpha(0.2), }; var title = new Label() { HorizontalOptions = LayoutOptions.Fill, HorizontalTextAlignment = TextAlignment.Center, FontSize = Sizes.TextMedium, TextColor = Colors.Text, FontAttributes = FontAttributes.Bold, BackgroundColor = Color.Transparent, }; title.SetBinding(Label.TextProperty, nameof(ViewModel.Title)); var description = new Label() { HorizontalOptions = LayoutOptions.Fill, FontSize = Sizes.TextSmall, TextColor = Colors.TextFaded, HorizontalTextAlignment = TextAlignment.Center, BackgroundColor = Color.Transparent, }; description.SetBinding(Label.TextProperty, nameof(ViewModel.Description)); var achievements = new TierScrollView() { Divisions = 3, ItemTemplate = new DataTemplate(typeof(TierScrollViewCell)), }; achievements.SetBinding(TierScrollView.ItemSourceProperty, nameof(ViewModel.Tiers)); achievements.SetBinding(TierScrollView.ItemTappedCommandProperty, nameof(ViewModel.TierSelectedCommand)); View = new Grid() { HeightRequest = 280, Children = { border, new Grid() { Padding = 20, RowDefinitions = new RowDefinitionCollection() { new RowDefinition() { Height = GridLength.Auto }, new RowDefinition() { Height = GridLength.Auto }, new RowDefinition() { Height = GridLength.Star }, }, Children = { { title, 0, 0 }, { description, 0, 1 }, { achievements, 0, 2 }, } }, } }; }