public InformationButton(MobileSortingService mobileSortingService, IMainThread mainThread) { _mainThread = mainThread; RowDefinitions = Rows.Define(AbsoluteGridLength(_diameter)); ColumnDefinitions = Columns.Define(AbsoluteGridLength(_diameter)); Children.Add(new FloatingActionTextButton(mobileSortingService, FloatingActionButtonSize.Mini, FloatingActionButtonType.Statistic1).Assign(out _statistic1FloatingActionButton) .Bind <FloatingActionTextButton, IReadOnlyList <Repository>, string>(FloatingActionTextButton.TextProperty, nameof(RepositoryViewModel.VisibleRepositoryList), convert: repositories => GetLabelTextConverter(mobileSortingService, repositories, FloatingActionButtonType.Statistic1)) .Invoke(fab => fab.SetBinding(IsVisibleProperty, getIsVisibleBinding()))); Children.Add(new FloatingActionTextButton(mobileSortingService, FloatingActionButtonSize.Mini, FloatingActionButtonType.Statistic2).Assign(out _statistic2FloatingActionButton) .Bind <FloatingActionTextButton, IReadOnlyList <Repository>, string>(FloatingActionTextButton.TextProperty, nameof(RepositoryViewModel.VisibleRepositoryList), convert: repositories => GetLabelTextConverter(mobileSortingService, repositories, FloatingActionButtonType.Statistic2)) .Invoke(fab => fab.SetBinding(IsVisibleProperty, getIsVisibleBinding()))); Children.Add(new FloatingActionTextButton(mobileSortingService, FloatingActionButtonSize.Mini, FloatingActionButtonType.Statistic3).Assign(out _statistic3FloatingActionButton) .Bind <FloatingActionTextButton, IReadOnlyList <Repository>, string>(FloatingActionTextButton.TextProperty, nameof(RepositoryViewModel.VisibleRepositoryList), convert: repositories => GetLabelTextConverter(mobileSortingService, repositories, FloatingActionButtonType.Statistic3)) .Invoke(fab => fab.SetBinding(IsVisibleProperty, getIsVisibleBinding()))); Children.Add(new FloatingActionTextButton(mobileSortingService, FloatingActionButtonSize.Normal, FloatingActionButtonType.Information, new AsyncCommand(ExecuteFloatingActionButtonCommand)) { FontFamily = FontFamilyConstants.RobotoMedium, Text = "TOTAL" }.Center() .DynamicResource(FloatingActionButtonView.RippleColorProperty, nameof(BaseTheme.PageBackgroundColor)) .Invoke(fab => fab.SetBinding(IsVisibleProperty, getIsVisibleBinding())));
public ActionSheetCell() { var grid = new Grid { RowDefinitions = Rows.Define(Star), ColumnDefinitions = Columns.Define(Auto, Star, Auto), Children = { new Label { } .Row(0).Column(0).Start().TextCenterVertical().FontSize(Device.GetNamedSize(NamedSize.Medium, typeof(Label))) .Bind(Label.TextProperty, nameof(Title)), new Label { TextColor = Color.Gray } .Row(0).Column(1).End().TextCenterVertical().FontSize(Device.GetNamedSize(NamedSize.Small, typeof(Label))) .Bind(Label.TextProperty, nameof(SelectedDisplayText)), new Label { Text = MaterialFont.ChevronRight } .Row(0).Column(2).EndExpand().TextCenterVertical().Font("MaterialIcon", Device.GetNamedSize(NamedSize.Medium, typeof(Label))) } }.Bind(Grid.MarginProperty, nameof(Margin)) .Invoke(v => v.GestureRecognizers.Add(new TapGestureRecognizer { }.Invoke(v => v.Tapped += TapGestureRecognizer_Tapped))) .Invoke(v => v.BindingContext = this); Children.Add(grid); }
public MonthDayPicker() { Content = new Grid { RowDefinitions = Rows.Define(Auto, Auto, Auto, Auto, Auto), ColumnDefinitions = Columns.Define(Star, Star, Star, Star, Star, Star, Star) }.Assign(out _root); int day = 1; for (int row = 0; row < 5; ++row) { for (int col = 0; col < 7; ++col) { if (day > 31) { break; } Frame frame = new Frame { BorderColor = Color.White, HasShadow = false, HeightRequest = 40, WidthRequest = 40, CornerRadius = 20, Padding = new Thickness(0), HorizontalOptions = new LayoutOptions(LayoutAlignment.Center, false), VerticalOptions = new LayoutOptions(LayoutAlignment.Center, false) }; TapGestureRecognizer frameTapGesture = new TapGestureRecognizer(); frameTapGesture.Tapped += FrameTapGesture_Tapped; frame.GestureRecognizers.Add(frameTapGesture); Label label = new Label { Text = day.ToString(GlobalSettings.Culture), Margin = new Thickness(0), Padding = new Thickness(0), VerticalOptions = new LayoutOptions(LayoutAlignment.Center, false), HorizontalOptions = new LayoutOptions(LayoutAlignment.Center, false) }; frame.Content = label; _root.Children.Add(frame, col, row); day++; } } _root.Children[SelectedDay - 1].BackgroundColor = SelectedColor; }
public void DefineRowsWithoutEnums() => AssertExperimental(() => { var grid = new Forms.Grid { RowDefinitions = Rows.Define(Auto, Star, 20) }; Assert.That(grid.RowDefinitions.Count, Is.EqualTo(3)); Assert.That(grid.RowDefinitions[0]?.Height, Is.EqualTo(GridLength.Auto)); Assert.That(grid.RowDefinitions[1]?.Height, Is.EqualTo(GridLength.Star)); Assert.That(grid.RowDefinitions[2]?.Height, Is.EqualTo(new GridLength(20))); });
public void DefineRowsWithoutEnums() { var grid = new Forms.Grid { RowDefinitions = Rows.Define(Auto, Star, Stars(starsValue), 20) }; Assert.That(grid.RowDefinitions.Count, Is.EqualTo(4)); Assert.That(grid.RowDefinitions[0]?.Height, Is.EqualTo(GridLength.Auto)); Assert.That(grid.RowDefinitions[1]?.Height, Is.EqualTo(GridLength.Star)); Assert.That(grid.RowDefinitions[2]?.Height, Is.EqualTo(starsLength)); Assert.That(grid.RowDefinitions[3]?.Height, Is.EqualTo(new GridLength(20))); }
public PersonListPage() { Title = PageTitles.PersonListPage; ViewModel.ErrorTriggered += HandleErrorTriggered; ToolbarItems.Add(new ToolbarItem { IconImageSource = "Add", AutomationId = AutomationIdConstants.PersonListPage_AddButton }.Invoke(addButtonToolBarItem => addButtonToolBarItem.Clicked += HandleAddButtonClicked)); Content = new Grid { RowDefinitions = Rows.Define(Star), ColumnDefinitions = Columns.Define(Star), Children = { new RefreshView { RefreshColor = Color.Black, Content = new CollectionView { ItemTemplate = new PersonListDataTemplate(), BackgroundColor = ColorConstants.PageBackgroundColor, AutomationId = AutomationIdConstants.PersonListPage_PersonList }.Bind(CollectionView.ItemsSourceProperty, nameof(PersonListViewModel.PersonList)) .Invoke(personList => personList.SelectionChanged += HandleSelectionChanged) }.Bind(RefreshView.IsRefreshingProperty, nameof(PersonListViewModel.IsRefreshing)) .Bind(RefreshView.CommandProperty, nameof(PersonListViewModel.PullToRefreshCommand)), new BoxView { BackgroundColor = new Color(1, 1, 1, 0.75) }.CenterExpand() .Bind(IsVisibleProperty, nameof(PersonListViewModel.IsDeletingPerson)), new ActivityIndicator { AutomationId = AutomationIdConstants.PersonListPage_ActivityIndicator }.Center() .Bind(IsVisibleProperty, nameof(PersonListViewModel.IsDeletingPerson)) .Bind(ActivityIndicator.IsRunningProperty, nameof(PersonListViewModel.IsDeletingPerson)) } }; }
private void Build() { InitializeViewModel(); Content = new Grid { RowDefinitions = Rows.Define(Star, Star), Children = { new Label { TextColor = Color.Black, HorizontalTextAlignment = TextAlignment.Center } .Row(0) .Center() .Bind(nameof(Vm.LoginText)), CreateSignInButtonsLayout() .Row(1) .FillHorizontal() .Top() .Bind(IsVisibleProperty, nameof(Vm.ShowsSignInButtons)), CreateLinkingButtonsLayout() .Row(1) .FillHorizontal() .Top() .Bind(IsVisibleProperty, nameof(Vm.ShowsLinkingButtons)), new ActivityIndicator { Color = Color.Black } .Row(1) .CenterHorizontal() .Top() .Bind(ActivityIndicator.IsRunningProperty, nameof(Vm.IsInProgress)), CreateSignOutButtonsLayout() .Row(1) .FillHorizontal() .Bottom() .Bind(IsVisibleProperty, nameof(Vm.ShowsSignOutButtons)) } } .Margin(24); }