/** Create the main grid that holds the other grids for the post * Post: Grid - the main grid **/ public Grid createFeedGridMain() { // Setup the grid Grid grid = new Grid { Padding = new Thickness(10,5,10,5), RowSpacing = 10, HeightRequest = 200, WidthRequest = 500, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.White, }; RowDefinition r = new RowDefinition (); r.Height = new GridLength(1.25, GridUnitType.Star); grid.RowDefinitions.Insert (0, r); RowDefinition r1 = new RowDefinition (); r1.Height = new GridLength(1.5, GridUnitType.Star); grid.RowDefinitions.Insert (1 , r1); RowDefinition r2 = new RowDefinition (); r2.Height = new GridLength(0.75, GridUnitType.Star); grid.RowDefinitions.Insert (2 , r2); ColumnDefinition c = new ColumnDefinition (); c.Width = GridLength.Auto; grid.ColumnDefinitions.Add (c); return grid; }
public viewcellitems() { #region creation de la view Nom_produit = new Label () { FontAttributes = FontAttributes.Bold, FontSize = 20, TextColor = Color.Black }; Nom_produit.SetBinding (Label.TextProperty, "Nom_produit"); var IconAnzeige = new Image (); IconAnzeige.SetBinding (Image.SourceProperty, new Binding ("IconName", BindingMode.OneWay, new StringToImageConverter ())); IconAnzeige.HeightRequest = 50; IconAnzeige.HorizontalOptions = LayoutOptions.EndAndExpand; IconAnzeige.VerticalOptions = LayoutOptions.End; Detail = new Label () { FontAttributes = FontAttributes.Bold, FontSize = 16, TextColor = Color.FromHex ("ff3498dc") }; Detail.SetBinding (Label.TextProperty, "Detail"); #region grid var rowdefdef = new RowDefinition { Height = GridLength.Auto, }; var columndef = new ColumnDefinition { Width = GridLength.Auto }; var grid = new Grid { HorizontalOptions = LayoutOptions.Fill, Padding = 5 }; grid.RowDefinitions.Add (rowdefdef); grid.ColumnDefinitions.Add (columndef); Nom_produit.SetValue (Grid.ColumnProperty, 0); Nom_produit.SetValue (Grid.RowProperty, 0); grid.Children.Add (Nom_produit); Detail.SetValue (Grid.ColumnProperty, 0); Detail.SetValue (Grid.RowProperty, 1); grid.Children.Add (Detail); IconAnzeige.SetValue (Grid.ColumnProperty, 1); IconAnzeige.SetValue (Grid.RowProperty, 0); grid.Children.Add (IconAnzeige); #endregion View = grid; #endregion }
private Grid createContentGrid(){ Grid content = new Grid (); RowDefinition r = new RowDefinition (); r.Height = new GridLength (9, GridUnitType.Star); content.RowDefinitions.Insert (0, r); r = new RowDefinition (); r.Height = new GridLength (1.2, GridUnitType.Star); content.RowDefinitions.Insert (1, r); return content; }
public MapPage() { Title = "Search For a Business"; BackgroundColor = Color.FromHex("#0DA195"); list = new MallListView (); Grid content = new Grid (); RowDefinition r = new RowDefinition (); r.Height = new GridLength (2, GridUnitType.Star); content.RowDefinitions.Insert (0, r); r = new RowDefinition (); r.Height = new GridLength (7, GridUnitType.Star); content.RowDefinitions.Insert (1, r); r = new RowDefinition (); r.Height = new GridLength (1.2, GridUnitType.Star); content.RowDefinitions.Insert (2, r); searchbar = new SearchBar () { Placeholder = "Search", }; searchbar.TextChanged += (sender, e) => list.FilterLocations (searchbar.Text); searchbar.SearchButtonPressed += (sender, e) => { list.FilterLocations (searchbar.Text); }; var stack = new StackLayout () { Children = { list } }; content.Children.Add (searchbar, 0, 0); content.Children.Add (stack, 0, 1); content.Children.Add (createFooter (), 0, 2); Content = content; }
public Page1() { this.SizeChanged += async delegate(object sender, EventArgs e) { MenuManager (); var hGrid = this.Height - 100; //g.HeightRequest = hGrid; //menu1.Height = hGrid; boxmenu1.HeightRequest = hGrid / 2; boxmenu1B.HeightRequest = hGrid / 2; }; g = new Grid (){ /*VerticalOptions = LayoutOptions.FillAndExpand*/ }; g.RowSpacing = 0; g.SizeChanged += async delegate(object sender, EventArgs e) { return; }; menu3 = new RowDefinition (); menu3.Height = new GridLength (100, GridUnitType.Absolute); g.RowDefinitions.Add (menu3); menu2 = new RowDefinition (); menu2.Height = new GridLength (100, GridUnitType.Absolute); g.RowDefinitions.Add (menu2); menu1 = new RowDefinition (); menu1.Height = new GridLength (100, GridUnitType.Absolute); g.RowDefinitions.Add (menu1); boxmenu3 = new BoxView (); boxmenu3.BackgroundColor = Color.Red; g.Children.Add (boxmenu3); Grid.SetRow (boxmenu3, 0); boxmenu2 = new BoxView (); boxmenu2.BackgroundColor = Color.Blue; g.Children.Add (boxmenu2); Grid.SetRow (boxmenu2, 1); var tapGestureRecognizer2 = new TapGestureRecognizer (); //tapGestureRecognizer.SetBinding (TapGestureRecognizer.CommandProperty, "Animate"); boxmenu2.GestureRecognizers.Add (tapGestureRecognizer2); tapGestureRecognizer2.Tapped += async delegate(object sender, EventArgs e) { await boxmenu2.ScaleTo (3, 10); }; boxmenu1 = new BoxView (){ VerticalOptions = LayoutOptions.End }; boxmenu1.BackgroundColor = Color.Yellow; g.Children.Add (boxmenu1); Grid.SetRow (boxmenu1, 2); var tapGestureRecognizer1 = new TapGestureRecognizer (); boxmenu1.GestureRecognizers.Add (tapGestureRecognizer1); tapGestureRecognizer1.Tapped += async delegate(object sender, EventArgs e) { //menu2IsVisible = true; //MenuManager (); //await boxmenu2.Animate( (); boxmenu1B.IsVisible = true; var hGrid = this.Height - 100; g.HeightRequest = hGrid; menu1.Height = hGrid; boxmenu1.HeightRequest = hGrid / 2; boxmenu1B.HeightRequest = hGrid / 2; await boxmenu1B.TranslateTo (0, -(hGrid / 2), 1000); }; boxmenu1B = new BoxView (){ VerticalOptions = LayoutOptions.End }; boxmenu1B.BackgroundColor = Color.Pink; boxmenu1B.IsVisible = false; g.Children.Add (boxmenu1B); Grid.SetRow (boxmenu1B, 2); Button b = new Button (); b.Text = "pag2"; b.Clicked += async delegate(object sender, EventArgs e) { Navigation.PushAsync (new Page2 (), true); }; Content = new StackLayout { VerticalOptions = LayoutOptions.EndAndExpand, Children = { g /* new Label { Text = "Hello ContentPage1" }, b, */ } }; }
private void BuildLayout() { Grid grid1 = new Grid(); grid1.VerticalOptions = LayoutOptions.FillAndExpand; grid1.HorizontalOptions = LayoutOptions.FillAndExpand; RowDefinition row1 = new RowDefinition(); row1.Height = new GridLength(1, GridUnitType.Star); RowDefinition row2 = new RowDefinition(); row2.Height = GridLength.Auto; grid1.RowDefinitions.Add(row1); grid1.RowDefinitions.Add(row2); var layout = new WrapLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, Spacing = 20, Orientation = StackOrientation.Horizontal, }; for (int i = 0; i < 8; i++) { var imgStr = "disaster-0" + (i + 1); var image = new Image { Source = Data.GetImageSource(imgStr), Aspect = Aspect.AspectFit, WidthRequest = 100, HeightRequest = 100 }; ImageWithInfo iWI = new ImageWithInfo { Info = imgStr, Image = image }; var tapGesture = new TapGestureRecognizer { Command = new Command(AlertTap), CommandParameter = iWI }; image.GestureRecognizers.Add(tapGesture); layout.Children.Add(image); } grid1.Children.Add(layout); Grid grid2 = new Grid(); ColumnDefinition grid2Column0 = new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star), }; ColumnDefinition grid2Column1 = new ColumnDefinition() { Width = GridLength.Auto, }; grid2.HorizontalOptions = LayoutOptions.FillAndExpand; grid2.Children.Add(entry); entry.HorizontalOptions = LayoutOptions.FillAndExpand; Grid.SetColumn(entry, 0); submitButton.Text = "Submit"; submitButton.IsEnabled = false; var tapSubmit = new TapGestureRecognizer { Command = new Command(SubmitTap), CommandParameter = SelectedImage }; submitButton.GestureRecognizers.Add(tapSubmit); grid2.Children.Add(submitButton); Grid.SetColumn(submitButton, 1); grid1.Children.Add(grid2); Grid.SetRow(grid2, 1); MainGrid.Children.Add(grid1); }
private void generateInitialView() { headerLabel = new Label { Text = "Customize Profile", FontAttributes = FontAttributes.Bold, TextColor = Color.White, XAlign = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, FontSize = 39 }; characterLabel = new Label { Text = "Your Emoji", TextColor = Color.White, FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Center, XAlign = TextAlignment.Center, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) }; characterGrid = new Grid { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, RowDefinitions = { new RowDefinition { Height = GridLength.Auto}, new RowDefinition { Height = GridLength.Auto }, }, ColumnDefinitions = { new ColumnDefinition { Width = GridLength.Auto }, new ColumnDefinition { Width = GridLength.Auto }, new ColumnDefinition { Width = GridLength.Auto }, new ColumnDefinition { Width = GridLength.Auto }, }, BackgroundColor = Color.White, ColumnSpacing = 5, Padding = new Thickness(5, 5, 5, 5) }; int counter = 0; for (int i = 0; i < characterButtons.Count / 2; i++) { for (int j = 0; j < 2; j++) { characterGrid.Children.Add(characterButtons[counter], i, j); counter++; } } characterBoxes = new ScrollView { Content = characterGrid, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Orientation = ScrollOrientation.Horizontal, BackgroundColor = Color.White }; colorLabel = new Label { Text = "Your Color", TextColor = Color.White, XAlign = TextAlignment.Center, FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Center, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) }; RowDefinition rd = new RowDefinition { Height = 60 }; colorGrid = new Grid { VerticalOptions = LayoutOptions.CenterAndExpand, RowDefinitions = { new RowDefinition { Height = rd.Height}, new RowDefinition { Height = rd.Height}, }, ColumnDefinitions = { new ColumnDefinition { Width = rd.Height }, new ColumnDefinition { Width = rd.Height }, new ColumnDefinition { Width = rd.Height}, new ColumnDefinition { Width = rd.Height} }, HorizontalOptions = LayoutOptions.Center, ColumnSpacing = 20f, RowSpacing = 20f, BackgroundColor = Color.White, // Padding = new Thickness(5, 20, 5, 20) }; counter = 0; for (int i = 0; i < colorButtons.Count / 2; i++) { for (int j = 0; j < 2; j++) { colorGrid.Children.Add(colorButtons[counter], i, j); counter++; } } colorBoxes = new ScrollView { Content = colorGrid, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Orientation = ScrollOrientation.Horizontal, BackgroundColor = Color.White, Padding = new Thickness(0, 10, 10, 10) }; bSkip = new Button { Text = "Skip", TextColor = Color.White, BackgroundColor = Color.Gray, FontAttributes = FontAttributes.Bold, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), HorizontalOptions = LayoutOptions.FillAndExpand, BorderRadius = 10, HeightRequest = 70 }; bSkip.Clicked += BSkip_Clicked; bContinue = new Button { Text = "Continue", TextColor = Color.White, BackgroundColor = Color.Lime, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), BorderRadius = 11, HeightRequest = 70, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.FillAndExpand }; bContinue.Clicked += BContinue_Clicked; Content = new StackLayout { Children = { headerLabel, characterLabel, characterBoxes, colorLabel, colorBoxes, new StackLayout { Children = { bSkip, bContinue }, Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Spacing =20, Padding = new Thickness(20,10,20,20) } }, // Padding = new Thickness(20, 0, 20, 20), Spacing = 10f, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromRgb(210, 61, 235) }; }
public CreateClubPage() { ch = new ColorHandler(); tagPage = new AddTagsPage(); clubPublic = true; clubColor = "default"; tagList = new List<string>(); colorButtons = this.generateColorButtons(); this.Padding = new Thickness(0, Device.OnPlatform(10, 0, 0), 0, 0); this.Title = "Create A Club"; titleLabel = new Label { Text = "Title", TextColor = Color.White, FontAttributes = FontAttributes.Bold, FontSize = 36, XAlign = TextAlignment.Center, VerticalOptions = LayoutOptions.Center }; clubNameEntry = new Entry { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, BackgroundColor = Color.White, TextColor = Color.Black, Placeholder = "Club Name" }; colorLabel = new Label { Text = "Color", TextColor = Color.White, FontAttributes = FontAttributes.Bold, FontSize = 36, XAlign = TextAlignment.Center, VerticalOptions = LayoutOptions.Center }; RowDefinition rd = new RowDefinition { Height = 60 }; colorGrid = new Grid { VerticalOptions = LayoutOptions.Center, RowDefinitions = { new RowDefinition { Height = rd.Height}, new RowDefinition { Height = rd.Height}, }, ColumnDefinitions = { new ColumnDefinition { Width = rd.Height }, new ColumnDefinition { Width = rd.Height }, new ColumnDefinition { Width = rd.Height }, new ColumnDefinition { Width = rd.Height } }, HorizontalOptions = LayoutOptions.CenterAndExpand, RowSpacing = 5, ColumnSpacing = 10, BackgroundColor = Color.White, Padding = new Thickness(70, 5, 70, 5) }; int counter = 0; for (int i = 0; i < (colorButtons.Count) / 2; i++) { for (int j = 0; j < 2; j++) { colorGrid.Children.Add(colorButtons[counter], i, j); counter++; } } inviteLabel = new Label { Text = "Invite Friends", TextColor = Color.White, FontAttributes = FontAttributes.Bold, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center }; tagsLabel = new Label { Text = "Add Tags", TextColor = Color.White, FontAttributes = FontAttributes.Bold, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center }; bAddTags = new Button { Text = tagPage.addedTags.Count.ToString(), TextColor = Color.White, BackgroundColor = ch.fromStringToColor("lightGray"), FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.FillAndExpand, BorderRadius = 7, VerticalOptions = LayoutOptions.Center }; bAddTags.Clicked += BAddTags_Clicked; bAddFriends = new Button { Text = "+", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), TextColor = Color.FromRgb(210, 61, 235), BackgroundColor = Color.White, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.FillAndExpand, BorderRadius = 7, VerticalOptions = LayoutOptions.Center }; bAddFriends.Clicked += BAddFriends_Clicked; bPublic = new Button { Text = "Public", TextColor = Color.White, BackgroundColor = ch.fromStringToColor("lightGrayPressed"), FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.FillAndExpand, BorderRadius = 7, VerticalOptions = LayoutOptions.Center }; bPublic.Clicked += BPublic_Clicked; bPrivate = new Button { Text = "Private", TextColor = Color.White, BackgroundColor = ch.fromStringToColor("red"), FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.FillAndExpand, BorderRadius = 7, VerticalOptions = LayoutOptions.Center }; bPrivate.Clicked += BPrivate_Clicked; bContinue = new Button { Text = "Continue", TextColor = Color.White, FontAttributes = FontAttributes.Bold, BackgroundColor = Color.Lime, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 80, BorderRadius = 15 }; bContinue.Clicked += BContinue_Clicked; lcouldntCreate = new Label { Text = "", TextColor = Color.Red, FontAttributes = FontAttributes.Bold, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center }; Content = updatePage(); }
/** Create the label grid that holds the posters name and the date+time of post. * Post: Grid - the label grid. **/ public Grid createLabelGrid(string user, DateTime date) { string nameText = user; string dataTimeText = date.ToLocalTime ().ToString (); // Setup the label grid that holds the labels name and dateTime Grid labelGrid = new Grid { Padding = 0 }; RowDefinition r = new RowDefinition (); r.Height = new GridLength(1, GridUnitType.Star); labelGrid.RowDefinitions.Add(r); ColumnDefinition c = new ColumnDefinition(); c.Width = new GridLength(1, GridUnitType.Star); labelGrid.ColumnDefinitions.Add (c); // Create Labels Label name = createFeedLabel (nameText, 16); name.FontAttributes = FontAttributes.Bold; name.WidthRequest = 500; Label dateTime = createFeedLabel (dataTimeText, 12); dateTime.FontAttributes = FontAttributes.Italic; dateTime.HorizontalOptions = LayoutOptions.EndAndExpand; // Add lables labelGrid.Children.Add (name, 0, 8, 0, 1); labelGrid.Children.Add (dateTime, 3, 7, 1, 2); return labelGrid; }