예제 #1
0
        /**	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;
        }
예제 #2
0
        public HolydayCell()
        {
            Label LabelName = new Label
            {
                TextColor = Color.White,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Start
            };
             Label LabelDate = new Label
            {
                TextColor = Color.White,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Start
            };
            LabelName.SetBinding(Label.TextProperty, "Name", BindingMode.TwoWay);
            LabelDate.SetBinding(Label.TextProperty, "Date", BindingMode.TwoWay);

            Grid grid = new Grid();
            var cd = new ColumnDefinition();
            cd.Width = GridLength.Auto;
            grid.ColumnDefinitions.Add(cd);
            cd = new ColumnDefinition();
            cd.Width = GridLength.Auto;
            grid.ColumnDefinitions.Add(cd);

            grid.Children.AddHorizontal(LabelName);
            grid.Children.AddHorizontal(LabelDate);
            View = 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
        }
예제 #4
0
        public void FormLayout(forms.View v)
        {
            this.v      = v;
            titleColumn = new forms.ColumnDefinition()
            {
                Width = titleColumnWidth
            };
            var formLayout = new forms.Grid()
            {
                RowDefinitions =
                {
                    new forms.RowDefinition()
                    {
                        Height = new forms.GridLength(1, forms.GridUnitType.Star)
                    },
                    new forms.RowDefinition()
                    {
                        Height = new forms.GridLength(1, forms.GridUnitType.Auto)
                    }
                },

                ColumnDefinitions =
                {
                    titleColumn,
                    new forms.ColumnDefinition {
                        Width = new forms.GridLength(1, forms.GridUnitType.Star)
                    },
                    new forms.ColumnDefinition {
                        Width = new forms.GridLength(1, forms.GridUnitType.Auto)
                    }
                },
                Margin     = new forms.Thickness(12, 0.5, 9, 0),
                RowSpacing = 0.5
            };

            titleColumn.Width = string.IsNullOrEmpty(Title) ? 0 : titleColumnWidth;
            label             = new forms.Label
            {
                VerticalOptions   = forms.LayoutOptions.CenterAndExpand,
                Text              = Title,
                FontSize          = TitleFontSize,
                LineBreakMode     = forms.LineBreakMode.TailTruncation,
                TextColor         = TitleColor,
                HorizontalOptions = forms.LayoutOptions.FillAndExpand,
            };

            detail = new forms.Label
            {
                VerticalOptions   = forms.LayoutOptions.FillAndExpand,
                Text              = Detail,
                FontSize          = forms.Device.GetNamedSize(forms.NamedSize.Micro, typeof(forms.Label)),
                LineBreakMode     = forms.LineBreakMode.TailTruncation,
                TextColor         = DetailColor,
                HorizontalOptions = InputHorizontalOptions
            };
            extraDetail = new forms.Label
            {
                VerticalOptions = forms.LayoutOptions.CenterAndExpand,
                Text            = ExtraDetail,
                FontSize        = forms.Device.GetNamedSize(forms.NamedSize.Micro, typeof(forms.Label)),
                LineBreakMode   = forms.LineBreakMode.TailTruncation,
                TextColor       = ExtraDetailColor
            };
            v.HorizontalOptions = InputHorizontalOptions;
            v.VerticalOptions   = forms.LayoutOptions.CenterAndExpand;
            formLayout.Children.Add(label, 0, 0);
            formLayout.Children.Add(v, 1, 0);

            formLayout.Children.Add(detail, 1, 1);
            formLayout.Children.Add(extraDetail, 2, 0);
            forms.Grid.SetRowSpan(label, 2);
            forms.Grid.SetRowSpan(extraDetail, 2);
            Tapped += FormEntryCell_Tapped;
            View    = formLayout;
            //formLayout.ForceLayout();
        }
예제 #5
0
        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);
            
        }
예제 #6
0
        /** Creates the inner grid that holds the label grid and profile picture.
         * 	Post: Grid - the inner grid.
         **/
        public Grid createInnerGrid(string name, DateTime date)
        {
            string profileImageLoc = "profile_filler.png";

            // Setup the inner grid that holds profile picture + label grid
            Grid innerGrid = new Grid {
                Padding = 0,
                ColumnSpacing = 5
            };
            ColumnDefinition c = new ColumnDefinition();
            ColumnDefinition c1 = new ColumnDefinition();
            ColumnDefinition c2 = new ColumnDefinition();

            c.Width = new GridLength(2, GridUnitType.Star);
            innerGrid.ColumnDefinitions.Insert(0, c);

            c1.Width = new GridLength(2, GridUnitType.Star);;
            innerGrid.ColumnDefinitions.Insert(1, c1);

            c2.Width = new GridLength(2, GridUnitType.Star);;
            innerGrid.ColumnDefinitions.Insert(2, c2);

            // Create the profile image
            RoundedBoxView profileImage = new RoundedBoxView {
                Source = profileImageLoc,
                HeightRequest = 100,
                WidthRequest = 100
            };

            innerGrid.Children.Add (profileImage, 0 ,0);
            innerGrid.Children.Add (createLabelGrid(name, date), 1, 10, 0, 1);

            return innerGrid;
        }
예제 #7
0
        /** 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;
        }