コード例 #1
0
ファイル: TemplatedGrid.cs プロジェクト: Haus4/NeCo
        private ColumnDefinitionCollection CreateColumnDefinitions()
        {
            var columnDefinitions = new ColumnDefinitionCollection();

            if (this.VerticalContentAlignment == TemplatedGridContentAlignment.Center)
            {
                columnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }

            foreach (var row in this.ItemsSource)
            {
                columnDefinitions.Add(new ColumnDefinition {
                    Width = GridLength.Auto
                });
            }

            if (this.VerticalContentAlignment == TemplatedGridContentAlignment.Center)
            {
                columnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }

            return(columnDefinitions);
        }
コード例 #2
0
        private void Grid_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            Grid ParentGrid = (Grid)sender;
            RowDefinitionCollection    parentRows = ParentGrid.RowDefinitions;
            ColumnDefinitionCollection parentCols = ParentGrid.ColumnDefinitions;

            if (parentRows.Count == 4)
            {
                Double maxH = e.NewSize.Height - parentRows[3].MinHeight -
                              parentRows[2].ActualHeight - parentRows[0].ActualHeight;
                parentRows[1].MaxHeight = maxH - 1; // work around window resizing issue

                if (e.NewSize.Height < e.PreviousSize.Height && parentRows[3].ActualHeight <= parentRows[3].MinHeight)
                {
                    parentRows[1].Height = new GridLength(parentRows[1].ActualHeight - (e.PreviousSize.Height - e.NewSize.Height));
                }
            }
            if (parentCols.Count == 3)
            {
                double maxW = e.NewSize.Width - parentCols[2].MinWidth - parentCols[1].ActualWidth;
                parentCols[0].MaxWidth = maxW - 1; // work around window resizing issue

                if (e.NewSize.Width < e.PreviousSize.Width && parentCols[2].ActualWidth <= parentCols[2].MinWidth)
                {
                    parentCols[0].Width = new GridLength(parentCols[0].ActualWidth - (e.PreviousSize.Width - e.NewSize.Width));
                }
            }
        }
コード例 #3
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            // Parameters: DesiredSize, WindowWidth, HeaderColumns
            double titleTextWidth = ((Size)values[0]).Width;
            double windowWidth    = (double)values[1];

            ColumnDefinitionCollection headerColumns = (ColumnDefinitionCollection)values[2];
            double titleColWidth   = headerColumns[2].ActualWidth;
            double buttonsColWidth = headerColumns[3].ActualWidth;


            // Result (1) Title is Centered across all HeaderColumns
            if ((titleTextWidth + buttonsColWidth * 2) < windowWidth)
            {
                return(1);
            }

            // Result (2) Title is Centered in HeaderColumns[2]
            if (titleTextWidth < titleColWidth)
            {
                return(2);
            }

            // Result (3) Title is Left-Aligned in HeaderColumns[2]
            return(3);
        }
コード例 #4
0
ファイル: GridManager.cs プロジェクト: antoinecronier/pokemon
        public GridManager(ColumnDefinitionCollection colDefCol, RowDefinitionCollection rowDefCol, Grid currentGrid)
        {
            this.ColDefCol = colDefCol;
            this.RowDefCol = rowDefCol;
            this.CurrentGrid = currentGrid;
            this.CurrentGrid.SizeChanged += CurrentGrid_SizeChanged;

            this.ColDefs = new List<ColumnDefinition>();
            this.RowDefs = new List<RowDefinition>();

            foreach (var itemColDefs in this.ColDefCol)
            {
                ColDefs.Add(itemColDefs);
            }
            foreach (var itemRowDefs in this.RowDefCol)
            {
                RowDefs.Add(itemRowDefs);
            }

            this.Player = new Image();
            var bitmapImage = new BitmapImage();
            bitmapImage.UriSource = new Uri("http://www.pokepedia.fr/images/d/d9/Sprite_3_f_Red.png");
            this.Player.Name = "ImagePlayer";
            this.Player.Source = bitmapImage;
            this.CurrentGrid.Children.Add(this.Player);
        }
コード例 #5
0
        public ToolbarView()
        {
            BindingContext = Toolbar.Instance;

            HorizontalOptions = LayoutOptions.Fill;
            VerticalOptions   = LayoutOptions.Center;
            Padding           = new Thickness(10, 0);

            ColumnDefinitions = new ColumnDefinitionCollection()
            {
                new ColumnDefinition()
                {
                    Width = GridLength.Auto
                },
                new ColumnDefinition()
                {
                    Width = GridLength.Star
                },
                new ColumnDefinition()
                {
                    Width = GridLength.Auto
                },
            };

            Children.Add(Icon(), 0, 3, 0, 1);
            Children.Add(Title(), 0, 3, 0, 1);
            Children.Add(Share(), 2, 0);
            Children.Add(Back(), 0, 0);
        }
コード例 #6
0
        private ColumnDefinitionCollection CreateColumnDefinitions()
        {
            var columnDefinitions = new ColumnDefinitionCollection();

            if (this.HorizontalContentAlignment == ManneTableViewContentAlignment.Center)
            {
                columnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }

            foreach (var column in this.ItemsSource.First())
            {
                columnDefinitions.Add(new ColumnDefinition {
                    Width = GridLength.Auto
                });
            }

            if (this.HorizontalContentAlignment == ManneTableViewContentAlignment.Center)
            {
                columnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }

            return(columnDefinitions);
        }
コード例 #7
0
        public static bool IsEqualTo(this ColumnDefinitionCollection columns, ColumnDefinitionCollection otherColumns)
        {
            if (columns == null && otherColumns == null)
            {
                return(true);
            }
            if (columns == null)
            {
                return(false);
            }
            if (otherColumns == null)
            {
                return(false);
            }
            if (columns.Count != otherColumns.Count)
            {
                return(false);
            }

            for (int i = 0; i < columns.Count; i++)
            {
                if (!columns[i].Width.Equals(otherColumns[i].Width))
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #8
0
 public VideoPlayer()
 {
     model          = new VideoModel();
     RowSpacing     = 0;
     RowDefinitions = new RowDefinitionCollection
     {
         // NATIVE VIDEO PLAYER
         //  new RowDefinition(),
         // SEEK BAR
         new RowDefinition()
         {
             Height = GridLength.Star
         },
     };
     ColumnDefinitions = new ColumnDefinitionCollection
     {
         new ColumnDefinition()
         {
             Width = GridLength.Star
         }
     };
     InitializeView();
     //InitializeSeekbarAutoHide();
     BindingContext = model;
 }
コード例 #9
0
        public DeviceListViewHeader()
        {
            var deviceName = new StyledLabel
            {
                CssStyle = "h2left",
                Text     = "Device Name"
            };
            var lastHeard = new StyledLabel
            {
                CssStyle        = "h2left",
                Text            = "Last Heard",
                VerticalOptions = LayoutOptions.Center,
            };

            ColumnDefinitions = new ColumnDefinitionCollection {
                new ColumnDefinition {
                    Width = new GridLength(2, GridUnitType.Star)
                },
                new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                }
            };

            Children.Add(deviceName, 0, 0);
            Children.Add(lastHeard, 1, 0);
            Padding = new Thickness(10, 0, 5, 0);
        }
コード例 #10
0
        public DeviceListViewHeader()
        {
            var deviceName = new Label {
                VerticalOptions = LayoutOptions.Center,
                Text            = "Device Name"
            };
            var lastHeard = new Label {
                VerticalOptions         = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.End,
                Text = "Last Head On"
            };

            ColumnDefinitions = new ColumnDefinitionCollection {
                new ColumnDefinition {
                    Width = new GridLength(2, GridUnitType.Star)
                },
                new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                }
            };

            Children.Add(deviceName, 0, 0);
            Children.Add(lastHeard, 1, 0);
            Padding = new Thickness(10, 0, 5, 0);
        }
コード例 #11
0
 public DemoGrid()
 {
     HeightRequest  = 70;
     RowSpacing     = 2;
     ColumnSpacing  = 5;
     RowDefinitions = new RowDefinitionCollection {
         new RowDefinition(),
         new RowDefinition(),
         new RowDefinition(),
     };
     ColumnDefinitions = new ColumnDefinitionCollection {
         new ColumnDefinition {
             Width = new GridLength(70)
         },
         new ColumnDefinition(),
         new ColumnDefinition {
             Width = new GridLength(50)
         },
     };
     Children.Add(new Icon("E", Color.FromRgb(0.4, 1.0, 1.0)), 0, 1, 0, 3);
     Children.Add(new Name("Evgeniy"), 1, 0);
     Children.Add(new Subject("Job"), 1, 1);
     Children.Add(new Body("Hi, Peter! Here is job available for you"), 1, 2);
     Children.Add(new Time("9:00 AM"), 2, 0);
 }
コード例 #12
0
        public DeviceListViewHeader()
        {
            var deviceName = new StyledLabel
            {
                CssStyle = "h2left",
                Text     = "Device Name"
            };
            var lastHeard = new StyledLabel
            {
                CssStyle          = "h2",
                Text              = "Last Heard",
                HorizontalOptions = LayoutOptions.End,
            };

            ColumnDefinitions = new ColumnDefinitionCollection {
                new ColumnDefinition {
                    Width = GridLength.Star
                },
                new ColumnDefinition {
                    Width = GridLength.Auto
                }
            };

            Children.Add(deviceName, 0, 0);
            Children.Add(lastHeard, 1, 0);
            Padding = new Thickness(10, 0, 10, 0);
        }
        protected override void OnRender(DrawingContext dc)
        {
            Pen pen = GridLinesPen;

            if (pen != null)
            {
                ColumnDefinitionCollection columnDefinitions = ColumnDefinitions;
                if (columnDefinitions.Count > 1)
                {
                    for (int i = 1; i < columnDefinitions.Count; i++)
                    {
                        ColumnDefinition columnDefinition = columnDefinitions[i];
                        double           offset           = columnDefinition.Offset;
                        dc.DrawLine(pen, new Point(offset, 0), new Point(offset, RenderSize.Height - 1));
                    }
                }

                RowDefinitionCollection rowDefinitions = RowDefinitions;
                if (rowDefinitions.Count > 1)
                {
                    for (int i = 1; i < rowDefinitions.Count; i++)
                    {
                        RowDefinition rowDefinition = rowDefinitions[i];
                        double        offset        = rowDefinition.Offset;
                        dc.DrawLine(pen, new Point(0, offset), new Point(RenderSize.Width - 1, offset));
                    }
                }
            }

            base.OnRender(dc);
        }
コード例 #14
0
ファイル: Grid.cs プロジェクト: zauberzeug/Xamarin.Forms
        void UpdateInheritedBindingContexts()
        {
            object bindingContext           = BindingContext;
            RowDefinitionCollection rowDefs = RowDefinitions;

            if (rowDefs != null)
            {
                for (var i = 0; i < rowDefs.Count; i++)
                {
                    RowDefinition rowdef = rowDefs[i];
                    SetInheritedBindingContext(rowdef, bindingContext);
                }
            }

            ColumnDefinitionCollection colDefs = ColumnDefinitions;

            if (colDefs != null)
            {
                for (var i = 0; i < colDefs.Count; i++)
                {
                    ColumnDefinition coldef = colDefs[i];
                    SetInheritedBindingContext(coldef, bindingContext);
                }
            }
        }
コード例 #15
0
        public SchedulePage()
        {
            selectDate = DateTime.Now;

            Title = "Schedule";

            isChangedMonth = true;


            // set Button
            beforeBtn.Clicked += BeforeBtn_Clicked;
            nextBtn.Clicked   += NextBtn_Clicked;

            // set grid layout for calendar
            RowDefinitionCollection rowDef = new RowDefinitionCollection();

            for (int i = 0; i < 6; i++)
            {
                rowDef.Add(new RowDefinition {
                    Height = new GridLength(30, GridUnitType.Absolute)
                });
            }
            ColumnDefinitionCollection colDef = new ColumnDefinitionCollection();

            for (int i = 0; i < 7; i++)
            {
                colDef.Add(new ColumnDefinition {
                    Width = new GridLength(20, GridUnitType.Star)
                });
            }
            calenderGrid.RowDefinitions    = rowDef;
            calenderGrid.ColumnDefinitions = colDef;
        }
コード例 #16
0
ファイル: Central.cs プロジェクト: ValeryVasina/Volunt-Area
        private Grid CreateGridWithMenu()
        {
            Grid grid = new Grid
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
            };

            Grid.SetRow(grid, 1);

            ColumnDefinitionCollection cd = grid.ColumnDefinitions;

            cd.Add(MenuColumn);
            cd.Add(new ColumnDefinition
            {
                Width = new GridLength(1, GridUnitType.Star)
            });

            grid.Children.Add(CreateMenuStack());

            ScrollView scroll = new ScrollView
            {
                Content = WorkPlace
            };

            Grid.SetColumn(scroll, 1);

            grid.Children.Add(scroll);

            return(grid);
        }
コード例 #17
0
        private void UIElement_OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (!_isGridSplitterUserDragged)
            {
                return;
            }
            TreeView treeView = sender as TreeView;

            if (treeView == null)
            {
                return;
            }
            Grid grid = treeView.Parent as Grid;

            if (grid == null)
            {
                return;
            }

            ColumnDefinitionCollection c = grid.ColumnDefinitions;
            bool isVisible = (bool)e.NewValue;

            if (isVisible)
            {
                c[TREE_VIEW_INDEX].Width = _treeViewColumnWidth;
            }
            else
            {
                c[TREE_VIEW_INDEX].Width = new GridLength(0);
            }
        }
コード例 #18
0
 public static void AddMultiple(this ColumnDefinitionCollection columnDefinitionCollection, params ColumnDefinition[] columnDefinitions)
 {
     foreach (var definition in columnDefinitions)
     {
         columnDefinitionCollection.Add(definition);
     }
 }
コード例 #19
0
        private void GenerateGrid()
        {
            for (int i = 0; i < 6; i++)
            {
                ColumnDefinitionCollection coldefs = ScheduleGrid.ColumnDefinitions;
                coldefs.Add(new ColumnDefinition());
            }

            DateTime time = _start;

            for (int i = 0; i < _numintervals; i++)
            {
                RowDefinitionCollection rowdefs = ScheduleGrid.RowDefinitions;
                rowdefs.Add(new RowDefinition()
                {
                    MaxHeight = _rowheight,
                    MinHeight = _rowheight,
                });
                Label TimeLabel = new Label()
                {
                    Content = time.ToString("HH:mm"),
                };
                Grid.SetRow(TimeLabel, i);
                Grid.SetColumn(TimeLabel, 0);
                ScheduleGrid.Children.Add(TimeLabel);
                time = time.Add(_interval);
            }
            DrawCourses();
        }
コード例 #20
0
			public ThirdTemplate()
			{
				RowDefinitions = new RowDefinitionCollection() {
					new RowDefinition() { Height = new GridLength(1d, GridUnitType.Star) }	
				};

				ColumnDefinitions = new ColumnDefinitionCollection() {
					new ColumnDefinition() { Width = new GridLength(1d, GridUnitType.Star) },
					new ColumnDefinition() { Width = GridLength.Auto }
				};

				var box = new BoxView() {
					Color = Color.Gray
				};

				var label = new Label() {
					HorizontalOptions = LayoutOptions.FillAndExpand,
					VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment = TextAlignment.End,
				};
				label.SetBinding<MultipleTemplatesPageModel.SimpleItem>(Label.TextProperty, v => v.Title);

				Children.Add(label, 0, 0);
				Children.Add(box, 1, 0);
			}
コード例 #21
0
        private void ChangeColumnDefinitions()
        {
            productDetailsColumnDefinitions = new ColumnDefinitionCollection
            {
                new ColumnDefinition {
                    Width = new GridLength(3, GridUnitType.Star)
                },
                new ColumnDefinition {
                    Width = new GridLength(40, GridUnitType.Star)
                },
                new ColumnDefinition {
                    Width = new GridLength(16, GridUnitType.Star)
                },
                new ColumnDefinition {
                    Width = new GridLength(14, GridUnitType.Star)
                },
                new ColumnDefinition {
                    Width = new GridLength(14, GridUnitType.Star)
                },
                new ColumnDefinition {
                    Width = new GridLength(10, GridUnitType.Star)
                },
                new ColumnDefinition {
                    Width = new GridLength(3, GridUnitType.Star)
                },
            };

            gridProductDetailsHeadings.ColumnDefinitions = productDetailsColumnDefinitions;
        }
コード例 #22
0
 public static void AddRange(this ColumnDefinitionCollection collection, IEnumerable <ColumnDefinition> columns)
 {
     foreach (var column in columns)
     {
         collection.Add(column);
     }
 }
コード例 #23
0
 /// <summary>
 /// Component to hold a 2D list of cards only showing the top card
 /// </summary>
 /// <param name="cards"></param>
 public HorizontalCardArrayComponent(List <List <ICard> > cards)
 {
     //Padding = 1;
     //Margin = 1;
     //MinimumHeightRequest = 100;
     RowDefinitions = new RowDefinitionCollection()
     {
         new RowDefinition()
         {
             Height = new GridLength(1, GridUnitType.Star)
         }
     };
     ColumnDefinitions = new ColumnDefinitionCollection();
     ColumnSpacing     = 1;
     RowSpacing        = 1;
     HorizontalOptions = LayoutOptions.FillAndExpand;
     VerticalOptions   = LayoutOptions.FillAndExpand;
     for (int i = 0; i < cards?.Count(); i++)
     {
         this.ColumnDefinitions.Add(new ColumnDefinition()
         {
             Width = new GridLength(1, GridUnitType.Star)
         });
         var lbl = new CardComponent(cards[i].LastOrDefault(), 0, i);
         this.Children.Add(lbl);
     }
 }
コード例 #24
0
        public Habit()
        {
            BackgroundColor = Color.AliceBlue;

            VerticalOptions   = LayoutOptions.FillAndExpand;
            HorizontalOptions = LayoutOptions.FillAndExpand;

            RowDefinitions = new RowDefinitionCollection()
            {
                new RowDefinition {
                    Height = GridLength.Auto
                }
            };

            ColumnDefinitions = new ColumnDefinitionCollection()
            {
                new ColumnDefinition {
                    Width = GridLength.Auto
                }
            };

            for (int i = 1; i <= 6; i++)
            {
                for (int j = 0; j < 11; j++)
                {
                    var button = new DayButton("Lv." + (j * 6 + i));
                    button.Clicked += OnButtonClicked;
                    Children.Add(button, i, j);
                }
            }
        }
コード例 #25
0
        protected override void OnExecute(UIMessageContext ctx)
        {
            var req = ctx.Get <CreateGridRequest>();

            if (req == null)
            {
                return;
            }

            var target = Surface[req.ParentId];

            if (target == null)
            {
                return;
            }

            var attached      = false;
            var rowCollection = new RowDefinitionCollection();
            var colCollection = new ColumnDefinitionCollection();

            for (var i = 0; i < req.Rows; i++)
            {
                var row = new RowDefinition();
                rowCollection.Add(row);
            }

            for (var j = 0; j < req.Columns; j++)
            {
                var col = new ColumnDefinition();
                colCollection.Add(col);
            }

            var view = new Grid
            {
                RowDefinitions    = rowCollection,
                ColumnDefinitions = colCollection,
                ColumnSpacing     = req.ColumnSpacing,
                RowSpacing        = req.RowSpacing
            };

            Thread.Invoke(() =>
            {
                attached = Surface.SetParent(view, target);
            });

            if (!attached)
            {
                return;
            }

            var pair = Surface[view.Id];

            ctx.SetResponse <CreateWidgetResponse>(res =>
            {
                res.Widget = pair.UIWidget;
                res.Parent = target.UIWidget;
                res.Suggest <GetVisualTreeRequest>();
            });
        }
コード例 #26
0
        protected void CreateWeeknumbers()
        {
            weekNumberLabels.Clear();
            WeekNumbers.Clear();
            if (!ShowNumberOfWeek)
            {
                return;
            }

            var columDef = new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            };
            var rowDef = new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            };

            var grid = new Grid {
                VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.Start, RowSpacing = 0, ColumnSpacing = 0, Padding = new Thickness(0, 0, 0, 0)
            };
            var columnDefinition = new ColumnDefinitionCollection {
                columDef
            };
            var rowDefinition = new RowDefinitionCollection {
                rowDef, rowDef, rowDef, rowDef, rowDef, rowDef
            };

            var numberOfWeekFontSize = NumberOfWeekFontSize * (Device.RuntimePlatform == Device.iOS ? 1.5 : 2.5);

            numberOfWeekFontSize = numberOfWeekFontSize * (Device.Idiom == TargetIdiom.Tablet ? 1.5 : 2.5);

            for (var i = 0; i < ShowNumOfMonths; i++)
            {
                var weekNumbers = grid;
                weekNumbers.ColumnDefinitions = columnDefinition;
                weekNumbers.RowDefinitions    = rowDefinition;
                weekNumbers.WidthRequest      = numberOfWeekFontSize;

                for (int r = 0; r < 6; r++)
                {
                    var labelTemp = new Label
                    {
                        HorizontalOptions       = LayoutOptions.FillAndExpand,
                        VerticalOptions         = LayoutOptions.FillAndExpand,
                        TextColor               = NumberOfWeekTextColor,
                        BackgroundColor         = NumberOfWeekBackgroundColor,
                        VerticalTextAlignment   = TextAlignment.Center,
                        HorizontalTextAlignment = TextAlignment.Center,
                        FontSize       = NumberOfWeekFontSize,
                        FontAttributes = NumberOfWeekFontAttributes,
                        FontFamily     = NumberOfWeekFontFamily,
                        WidthRequest   = Device.Idiom == TargetIdiom.Tablet ? 80 : 0
                    };
                    weekNumberLabels.Add(labelTemp);

                    weekNumbers.Children.Add(weekNumberLabels.Last(), 0, r);
                }
                WeekNumbers.Add(weekNumbers);
            }
        }
コード例 #27
0
        public EntryLayout()
        {
            ColumnSpacing     = 0;
            ColumnDefinitions = new ColumnDefinitionCollection {
                new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Auto)
                },
                new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Auto)
                },
                new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                },
                new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Auto)
                },
                new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Auto)
                }
            };
            RowSpacing     = 0;
            RowDefinitions = new RowDefinitionCollection {
                new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Auto)
                },
                new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Auto)
                },
                new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Auto)
                }
            };

            _frameEntry = new Frame
            {
                Padding   = 0,
                HasShadow = false,
            };
            _frameEntry.SetBinding(Frame.CornerRadiusProperty,
                                   new Binding(nameof(EntryCornerRadius))
            {
                Source = this, Mode = BindingMode.OneWay
            });
            _frameEntry.SetBinding(HeightRequestProperty,
                                   new Binding(nameof(EntryHeightRequest))
            {
                Source = this, Mode = BindingMode.OneWay
            });

            _line = new BoxView
            {
                HeightRequest     = 2,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.End,
                BackgroundColor   = LineColor,
            };
            Children.Add(_frameEntry, 1, 4, 1, 2);
            Children.Add(_line, 1, 4, 1, 2);
        }
コード例 #28
0
 /// <summary>
 /// Clears the Collection and Creates n amount of new definitions
 /// </summary>
 /// <param name="collumns">The collection to refresh</param>
 /// <param name="n">the amount of collumns required</param>
 private static void ResetColumns(ColumnDefinitionCollection collumns, int n)
 {
     collumns.Clear();
     for (int i = 0; i < n; i++)
     {
         collumns.Add(new ColumnDefinition());
     }
 }
コード例 #29
0
        public static ColumnDefinition AddColumn(this ColumnDefinitionCollection defn, double Width)
        {
            var coldef = new ColumnDefinition();

            coldef.Width = new GridLength(Width);
            defn.Add(coldef);
            return(coldef);
        }
コード例 #30
0
        public static ColumnDefinition AddAutoColumn(this ColumnDefinitionCollection defn)
        {
            var coldef = new ColumnDefinition();

            coldef.Width = GridLength.Auto;
            defn.Add(coldef);
            return(coldef);
        }
コード例 #31
0
        public static ColumnDefinition AddStarColumn(this ColumnDefinitionCollection defn, int NumberUnits = 1)
        {
            var coldef = new ColumnDefinition();

            coldef.Width = new GridLength(NumberUnits, GridUnitType.Star);
            defn.Add(coldef);
            return(coldef);
        }
コード例 #32
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var items = value as IEnumerable<MainContentChildViewModel>;

            var collection = new ColumnDefinitionCollection();
            foreach (var item in items)
            {
                collection.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
                //collection.Add(item.ChildView);
            }
            return collection;
        }
		/// <summary>
		/// Override this method to execute an action when the BindingContext changes.
		/// </summary>
		/// <remarks></remarks>
		protected override void OnBindingContextChanged()
		{
			base.OnBindingContextChanged();

			var container = BindingContext as IList;

			if (container == null)
				return;

			FlowListView flowListView = null;
			if (_flowListViewRef.TryGetTarget(out flowListView) && flowListView != null)
			{
				_flowColumnTemplate = flowListView.FlowColumnTemplate;
				_desiredColumnCount = flowListView.DesiredColumnCount;
				_flowColumnExpand = flowListView.FlowColumnExpand;
			}
				
			// Getting view types from templates
			var containerCount = container.Count;
			IList<DataTemplate> templates = GetDataTemplates(container);
			bool layoutChanged = RowLayoutChanged(containerCount, templates);

			if (!layoutChanged) // REUSE VIEWS
			{
				if (_useGridAsMainRoot)
				{
					for (int i = 0; i < containerCount; i++)
					{
						SetBindingContextForView(_rootLayoutAuto.Children[i], container[i]);
					}
				}
				else
				{
					for (int i = 0; i < containerCount; i++)
					{
						SetBindingContextForView(_rootLayout.Children[i], container[i]);
					}
				}
			}
			else // RECREATE COLUMNS
			{
				if (_useGridAsMainRoot)
				{
					if (_rootLayoutAuto.Children.Count > 0)
						_rootLayoutAuto.Children.Clear();
				}
				else
				{
					if (_rootLayout.Children.Count > 0)
						_rootLayout.Children.Clear();
				}

				_currentColumnTemplates = new List<DataTemplate>(templates);

				if (_useGridAsMainRoot)
				{
					if (_rootLayoutAuto.Children.Count > 0)
						_rootLayoutAuto.Children.Clear();

					var colDefs = new ColumnDefinitionCollection();
					for (int i = 0; i < _desiredColumnCount; i++)
					{
						colDefs.Add(new ColumnDefinition() { Width = new GridLength(1d, GridUnitType.Star) });
					}
					_rootLayoutAuto.ColumnDefinitions = colDefs;

					for (int i = 0; i < containerCount; i++)
					{
						var view = (View)templates[i].CreateContent();

						view.GestureRecognizers.Add(new TapGestureRecognizer()
						{
							Command = new Command(async (obj) =>
							{
								await ExecuteTapGestureRecognizer(view);
							})
						});

						SetBindingContextForView(view, container[i]);
						if (containerCount == 0 || _desiredColumnCount == 0)
							return;

						AddViewToLayoutAutoHeightEnabled(view, containerCount, i);
					}
				}
				else
				{
					if (_rootLayout.Children.Count > 0)
						_rootLayout.Children.Clear();

					for (int i = 0; i < containerCount; i++)
					{
						var view = (View)templates[i].CreateContent();

						view.GestureRecognizers.Add(new TapGestureRecognizer()
						{
							Command = new Command(async (obj) =>
							{
								await ExecuteTapGestureRecognizer(view);
							})
						});

						SetBindingContextForView(view, container[i]);
						if (containerCount == 0 || _desiredColumnCount == 0)
							return;

						AddViewToLayoutAutoHeightDisabled(view, containerCount, i);
					}
				}
			}
		}
コード例 #34
0
ファイル: ToolBarPage.cs プロジェクト: Surfoo/WF.Player
		/// <summary>
		/// Handles the collection changed.
		/// </summary>
		/// <remarks>
		/// The bottom could only have one sort of buttons: text or icons.
		/// If there are more buttons with text than the bottom could hold, than the overflow menu is shown.
		/// </remarks>
		/// <param name="sender">Sender of event.</param>
		/// <param name="e">Collection changed event arguments.</param>
		private void HandleCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
		{
			BottomLayout.Children.Clear();

			var textLayout = new StackLayout() {
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.Fill,
			};

			foreach (ToolButton t in buttons)
			{
				if (t is ToolTextButton)
				{
					var button = new ExtendedButton() 
						{
							Text = (t is ToolTextButton) ? ((ToolTextButton)t).Text : null,
							TextColor = App.Colors.Tint,
							Image = null,
							HorizontalOptions = LayoutOptions.FillAndExpand,
							BackgroundColor = Color.Transparent,
							Command = new Command((parameter) => KeyClick(t.Command, parameter)),
							CommandParameter = (t is ToolTextButton) ? ((ToolTextButton)t).Text : null,
							#if __IOS__
							Font = Font.SystemFontOfSize(20),
							#endif
							IsVisible = t.IsVisibleAtStartup,
						};

					// Save for later use
					t.Button = button;

					// If only one text button, than add to stack layout
					if (buttons.Count <= 1)
					{
						BottomLayout.Children.Add(button);
					}
					else
					{
						textLayout.Children.Add(button);
					}
				}

				if (t is ToolIconButton)
				{
					var button = new ExtendedButton() 
						{
							Text = (t is ToolTextButton) ? ((ToolTextButton)t).Text : null,
							TextColor = App.Colors.Tint,
							Image = (t is ToolIconButton) ? ((ToolIconButton)t).Icon : null,
							HorizontalOptions = Device.OnPlatform<LayoutOptions>(LayoutOptions.FillAndExpand, LayoutOptions.CenterAndExpand, LayoutOptions.FillAndExpand),
							BackgroundColor = Color.Transparent,
							Command = new Command((parameter) => KeyClick(t.Command, parameter)),
							CommandParameter = (t is ToolIconButton) ? ((ToolIconButton)t).Icon : null,
							IsVisible = t.IsVisibleAtStartup,
						};

					// Save for later use
					t.Button = button;

					BottomLayout.Children.Add(button);
				}
			}

			if (buttons.Count == 0 || buttons[0] is ToolIconButton)
			{
				// If the first button is an icon, than we are ready
				return;
			}

			Thickness padding = new Thickness(10, 0);
			double spacing = 6;

			// Get max size of bottom
			var maxWidth = (BottomLayout.Width == -1 ? DependencyService.Get<IScreen>().Width : BottomLayout.Width) - padding.Left - padding.Right;

			if (buttons.Count == 1)
			{
				// We only have one button, so set width to maximum width 
				BottomLayout.Padding = padding;
				buttons[0].Button.WidthRequest = BottomLayout.Width - padding.Left - padding.Right;

				if (((ToolTextButton)buttons[0]).TextWidth > maxWidth)
				{
					// Text is wider than maxWidth, so scale font
					var fontSize = ((ToolTextButton)buttons[0]).Button.FontSize * maxWidth / ((ToolTextButton)buttons[0]).TextWidth - 1;

					((ToolTextButton)buttons[0]).Button.FontSize = fontSize > 14 ? fontSize : 14;
				}

				return;
			}

			// So, now we know, that we have more than one text button.

			// Check, if all buttons fit into the bottom grid.
			double sumWidth = 0;

			// Get width of all buttons
			for (int i = 0; i < buttons.Count; i++)
			{
				sumWidth += ((ToolTextButton)buttons[i]).TextWidth;
			}

			// Add spacing between
			sumWidth += spacing * (buttons.Count - 1);

			// Now check, if all buttons want fit into the bottom line
			if (sumWidth > maxWidth)
			{
				// No. There are more buttons than space, so create an extra menu

				// Create button for extra menu
				var button = new ExtendedButton() 
					{
						Text = OverflowMenuText,
						TextColor = App.Colors.Tint,
						Image = null,
						HorizontalOptions = LayoutOptions.FillAndExpand,
						BackgroundColor = Color.Transparent,
						Command = new Command(HandleOverflowMenuClick),
						#if __IOS__
						Font = Font.SystemFontOfSize(20),
						#endif
					};

				BottomLayout.Children.Add(button);
			}
			else
			{
				// Yes. All buttons should fit into the bottom line.

				// Create grid for buttons
				Grid grid = new Grid() {
					VerticalOptions = LayoutOptions.FillAndExpand,
					HorizontalOptions = LayoutOptions.FillAndExpand,
					RowDefinitions = {
						new RowDefinition { Height = GridLength.Auto },
					},
					ColumnSpacing = 0, //spacing,
				};

				// Create columns for buttons
				var colDefs = new ColumnDefinitionCollection();

				colDefs.Add(new ColumnDefinition { Width = new GridLength(((ToolTextButton)buttons[0]).TextWidth, GridUnitType.Absolute) });

				// Set layout of first button
				buttons[0].Button.HorizontalOptions = LayoutOptions.StartAndExpand;

				// Set width (autosize) and layout of all buttons between first and last
				for (int i = 1; i < buttons.Count - 1; i++)
				{
					colDefs.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); //((ToolTextButton)buttons[i]).TextWidth + padding.Left + padding.Right, GridUnitType.Absolute) });
					buttons[i].Button.HorizontalOptions = LayoutOptions.CenterAndExpand;
				}

				if (buttons.Count == 2)
				{
					// If we only have two buttons, than add an empty col with autosize width
					colDefs.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); // Width = GridLength.Auto }); // 
					colDefs.Add(new ColumnDefinition { Width = new GridLength(((ToolTextButton)buttons[buttons.Count-1]).TextWidth, GridUnitType.Absolute) }); // Width = GridLength.Auto }); // 
					buttons[buttons.Count-1].Button.HorizontalOptions = LayoutOptions.EndAndExpand;
				}
				else
				{
					// If we have more than 2 buttons, than set width to real size of button
					colDefs.Add(new ColumnDefinition { Width = new GridLength(((ToolTextButton)buttons[buttons.Count-1]).TextWidth, GridUnitType.Absolute) }); // Width = GridLength.Auto }); // 
					buttons[buttons.Count-1].Button.HorizontalOptions = LayoutOptions.EndAndExpand;
				}

				// Set column definitions for the buttons
				grid.ColumnDefinitions = colDefs;

				// Add all buttons to the grid
				var index = 0;

				for (int i = 0; i < buttons.Count; i++)
				{
					if (buttons.Count == 2 && i == 1)
					{
						// Add empty col
						index++;
					}

//					grid.Children.Add(new BoxView() { BackgroundColor = Color.FromRgb(i * 64, i * 64, i * 64), }, i + index, 0);
					grid.Children.Add(buttons[i].Button, i + index, 0);
				}

				// Add grid to BottomLayout
				BottomLayout.Padding = padding;
				BottomLayout.Children.Add(grid);
			}
		}
コード例 #35
0
        public ExternalQuoteView()
        {
            Bubble.BackgroundImage.Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.BubbleExternal");
            Bubble.Padding = new Thickness(17,10,10,10);
            Bubble.HorizontalOptions = LayoutOptions.Start;

            HeadShot.Source = ImageSource.FromResource("Forms9PatchDemo.Resources.236-baby.png");

            ColumnDefinitions = new ColumnDefinitionCollection {
                new ColumnDefinition { Width = 40 },
                new ColumnDefinition { Width = GridLength.Auto },
            };

            Children.Add(Bubble, 1,0);
            Children.Add(HeadShot, 0, 0);
            Grid.SetRowSpan(HeadShot,2);
        }
コード例 #36
0
        public InternalQuoteView()
        {
            Bubble.BackgroundImage.Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.BubbleInternal");
            Bubble.Padding = new Thickness(10,10,17,10);
            Bubble.HorizontalOptions = LayoutOptions.End;

            HeadShot.Source = ImageSource.FromResource("Forms9PatchDemo.Resources.236-lincoln.png");

            ColumnDefinitions = new ColumnDefinitionCollection {
                new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star)  },
                new ColumnDefinition { Width = 40 },
            };

            Children.Add(Bubble, 0,0);
            Children.Add(HeadShot, 1,0);
            Grid.SetRowSpan(HeadShot,2);
        }
コード例 #37
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var items = value as IEnumerable<ICarouselViewModel>;

            var collection = new ColumnDefinitionCollection();
            foreach (var item in items)
            {
                collection.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
            }
            return collection;
        }
コード例 #38
0
ファイル: GamePage.cs プロジェクト: palaniakasapu/Xamarin
        public Grid10Cartas(MemoramaViewModel ViewModel)
        {
            double ancho = App.Width / 4;
            ViewModel.CardSize = (int)Device.OnPlatform((ancho * .6), (ancho * 1.3), (ancho * 1.3));

            RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition { Height = new GridLength(ancho, GridUnitType.Absolute) },
                    new RowDefinition { Height = new GridLength(ancho, GridUnitType.Absolute) },
                    new RowDefinition { Height = new GridLength(ancho, GridUnitType.Absolute) },
                    new RowDefinition { Height = new GridLength(ancho, GridUnitType.Absolute) },
                    new RowDefinition { Height = new GridLength(ancho, GridUnitType.Absolute) }
                };
            ColumnDefinitions = new ColumnDefinitionCollection
                {
                    new ColumnDefinition { Width = new GridLength(ancho, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(ancho, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(ancho, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(ancho, GridUnitType.Absolute) }
                };

            int col = 0;
            int ren = 0;
            for (int i = 0; i < ViewModel.CardCount * 2; i++)
            {
                if (col == 4)
                {
                    col = 0;
                    ren++;
                }
                var imgTmp = new ImageButton
                {
                    BackgroundColor = Color.White,
                    BorderWidth = 0,
                    BorderColor = Color.White,
                    BindingContext = ViewModel.MemoryCardList[i],
                    Command = ViewModel.SeleccionaCartaCommnad,
                    CommandParameter = i,
                    Orientation = ImageOrientation.ImageToLeft,
                    ImageWidthRequest = ViewModel.CardSize,
                    ImageHeightRequest = ViewModel.CardSize
                };
                imgTmp.SetBinding(ImageButton.SourceProperty, new Binding("Imagen", BindingMode.OneWay, new ImageConverter()));
                Children.Add(imgTmp, col, ren);
                col++;
            }

        }
コード例 #39
0
        public GridMainScreen()
        {
            var label1 = new Label {
                Text = "Process payments from your tablet.",
                HorizontalOptions = LayoutOptions.Center
            };
            var label2 = new Label {
                Text = "Quickly and securely.",
                HorizontalOptions = LayoutOptions.Center
            };
            var label3 = new Label {
                Text = "Bolletta",
                VerticalOptions = LayoutOptions.Center
            };
            var label4 = new Label {
                Text = "Mobile Cashier",
                VerticalOptions = LayoutOptions.Center
            };
            var label5 = new Label {
                Text = "Please enter your Username and Password to sign in"
            };
            var label6 = new Label {
                Text = "Forgot"
            };
            var label7 = new Label {
                Text = "Sign"
            };
            var usernameEntry = new Entry {
                Placeholder = "Username"
            };
            var passwordEntry = new Entry {
                Placeholder = "Password",
                IsPassword = true
            };

            var bolettaImage = new Image {
                                Source = "http://a4.mzstatic.com/us/r30/Purple4/v4/02/8d/e2/028de2c0-0a91-9e68-0b61-5a7f7fae4577/icon175x175.png"
            };

            Button button1 = new Button {
                Text = "Forgot Password",
                TextColor = Color.Black,
                BorderColor = Color.Black,
                BorderWidth = 1
            };

            Button button2 = new Button {
                Text = "Sign In",
                TextColor = Color.Black,
                BorderColor = Color.Black,
                BorderWidth = 1
            };

            var bg = Color.White;

            StackLayout st = new StackLayout { BackgroundColor = Color.White,
            };

            // Grid Attributes
            RowSpacing = 2;

            RowDefinitions = new RowDefinitionCollection {
                new RowDefinition (),	// Row 0-1
                new RowDefinition (),	// Row 1-2
                new RowDefinition (),	// Row 2-3
                new RowDefinition (),	// Row 3-4
                new RowDefinition (),	// Row 4-5
                new RowDefinition (),	// Row 5-6
                new RowDefinition (),	// Row 6-7
                new RowDefinition (),	// Row 7-8
                new RowDefinition (),	// Row 8-9
                new RowDefinition (),	// Row 9-10
                new RowDefinition (),	// Row 10-11
                new RowDefinition (),	// Row 11-12
                new RowDefinition (),	// Row 12-13
            };
            ColumnDefinitions = new ColumnDefinitionCollection {
                new ColumnDefinition { Width = new GridLength(5) },	// Column 0-1
                new ColumnDefinition { Width = new GridLength(10)},	// Column 1-2
                new ColumnDefinition (),							// Column 2-3
                new ColumnDefinition (),							// Column 3-4
                new ColumnDefinition (),							// Column 4-5
                new ColumnDefinition { Width = new GridLength(10)},	// Column 5-6
                new ColumnDefinition { Width = new GridLength(5) },	// Column 6-7
            };
            // Specify in format (column start, column end, row start, row end);
            Children.Add (st,1,6,4,12);
            Children.Add (label1,2,6,1,2);
            Children.Add (label2,2,6,2,3);
            Children.Add (bolettaImage,2,3,5,7);
            Children.Add (label3,3,6,5,6);
            Children.Add (label4,3,6,6,7);
            Children.Add (label5,2,6,7,8);
            Children.Add (usernameEntry,2,5,8,9);
            Children.Add (passwordEntry,2,5,9,10);
            Children.Add (button1,3,4,10,11);
            Children.Add (button2,4,5,10,11);
        }
コード例 #40
0
		public SimplePushAlertView()
		{
			RowDefinitions = new RowDefinitionCollection
			{
				new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)}
			};

			// Allow taps to pass through
			InputTransparent = true;

			if (Device.Idiom == TargetIdiom.Phone)
			{
				ColumnDefinitions = new ColumnDefinitionCollection
				{
					// Content
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
				};
			}
			else
			{
				ColumnDefinitions = new ColumnDefinitionCollection
				{
					// Spacer
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
					// Content
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)},
					// Spacer
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
				};
			}

			_contentGrid = new Grid
			{
				RowDefinitions = new RowDefinitionCollection
				{
					new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)},
					new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)},
					new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)}
				},
				ColumnDefinitions = new ColumnDefinitionCollection
				{
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)},
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)}
				},
				BackgroundColor = Color.Teal,
				InputTransparent = InputTransparent
			};

			// No spacers needed on phone
			_contentGrid.SetGridProperties(0, Device.Idiom == TargetIdiom.Phone ? 0 : 1);

			Children.Add(_contentGrid);

			_image = new Image
			{
				HeightRequest = 32,
				WidthRequest = 32,
				InputTransparent = InputTransparent
			};
			_contentGrid.Children.Add(_image
				.WithPadding(10)
				.SetGridProperties(0, 0, 2));

			_titleLabel = new Label
			{
				TextColor = Color.White,
				FontSize = 16,
				InputTransparent = InputTransparent
			};
			_contentGrid.Children.Add(_titleLabel
				.WithPadding(10, 10, 0, 0)
				.SetGridProperties(0, 1));

			_bodyLabel = new Label
			{
				TextColor = Color.White,
				FontSize = 12,
				WidthRequest = 320,
				InputTransparent = InputTransparent
			};
			_contentGrid.Children.Add(_bodyLabel
				.WithPadding(0, 10, 0, 0)
				.SetGridProperties(1, 1));

		}
コード例 #41
0
ファイル: Grid.cs プロジェクト: evnik/UIFramework
 /// <summary>
 /// Initializes a new instance of Grid.
 /// </summary>
 public Grid()
 {
     this.columnDefinitions = new ColumnDefinitionCollection(this);
     this.rowDefinitions = new RowDefinitionCollection(this);
     this.Children.CollectionChanged += this.Children_CollectionChanged;
 }
コード例 #42
0
        private ColumnDefinitionCollection CreateColumnDefinitions()
        {
            var columnDefinitions = new ColumnDefinitionCollection();

            if(this.HorizontalContentAlignment == TemplatedTableViewContentAlignment.Center)
            {
                columnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
            }

            foreach(var column in this.ItemsSource)
            {
                columnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
            }

            if(this.HorizontalContentAlignment == TemplatedTableViewContentAlignment.Center)
            {
                columnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
            }

            return columnDefinitions;
        }
コード例 #43
0
	public LoginGridView ()
	{
		var label1 = new Label {
			Text = "Process payments from your tablet.",
			HorizontalOptions = LayoutOptions.Center,
			VerticalOptions = LayoutOptions.End,
			TextColor = Color.White,
			Font = Font.SystemFontOfSize (NamedSize.Large),
			FontAttributes = FontAttributes.Bold
		};
		var label2 = new Label {
			Text = "Quickly and securely.",
			HorizontalOptions = LayoutOptions.Center,
			VerticalOptions = LayoutOptions.Start,
			TextColor = Color.White,
			Font = Font.SystemFontOfSize (NamedSize.Medium),
		};
		var label3 = new Label {
			Text = "Bolletta",
			VerticalOptions = LayoutOptions.Center,
			HorizontalOptions = LayoutOptions.Start,
			TextColor = Color.FromHex ("FF9800"),
			Font = Font.SystemFontOfSize (NamedSize.Medium),

		};
		var label4 = new Label {
			Text = "MOBILE CASHIER",
			VerticalOptions = LayoutOptions.Center,
			HorizontalOptions = LayoutOptions.Start,
			TextColor = Color.Gray,
			Font = Font.SystemFontOfSize (NamedSize.Micro),
		};
		var label5 = new Label {
			Text = "Please enter your Username and Password to sign in",
			TextColor = Color.Gray,
			VerticalOptions = LayoutOptions.End,
		};

//		var label6 = new Label {
//			Text = "Forgot"
//		};
//		var label7 = new Label {
//			Text = "Sign"
//		};

		var usernameEntry = new Entry {
			Placeholder = "Username"
		};
		var passwordEntry = new Entry {
			Placeholder = "Password",
			IsPassword = true
		};

		var bolettaImage = new Image {
			Source = "http://a4.mzstatic.com/us/r30/Purple4/v4/02/8d/e2/028de2c0-0a91-9e68-0b61-5a7f7fae4577/icon175x175.png",
			HeightRequest = 10,
			WidthRequest = 10,
		};

		Button buttonForgotPass = new Button {
			Text = "Forgot Password",
			TextColor = Color.White,
			BorderColor = Color.Black,
			BackgroundColor = Color.FromHex ("2196F3"),
			BorderWidth = 1
		};
		buttonForgotPass.Clicked += OnForgotPassClicked;
//		buttonForgotPass.Clicked += async (sender, e) => {
//			var action = await Page.DisplayActionSheet ("ActionSheet: Save Photo?", "Cancel", "Delete", "Photo Roll", "Email");
//			Debug.WriteLine("Action: " + action); // writes true or false to the console
//		};

		Button buttonSignIn = new Button {
			Text = "Sign In",
			TextColor = Color.White,
			BorderColor = Color.Black,
			BackgroundColor = Color.FromHex ("2196F3"),
			BorderWidth = 1,
			Command = new Command (() => Navigation.PushModalAsync (new RootPage ()))
		};
//		buttonSignIn.Clicked += OnSignInClicked;
//			var bg = Color.White;

		StackLayout loginSquare = new StackLayout { BackgroundColor = Color.FromHex ("E3F2FD"),
		};


		// Grid Attributes
		RowSpacing = 2;

		RowDefinitions = new RowDefinitionCollection {
			new RowDefinition (),	// Row 0-1
			new RowDefinition (),	// Row 1-2
			new RowDefinition (),	// Row 2-3
			new RowDefinition (),	// Row 3-4
			new RowDefinition { Height = new GridLength (30) },	// Row 4-5
			new RowDefinition { Height = new GridLength (30) },	// Row 5-6
			new RowDefinition { Height = new GridLength (30) },	// Row 6-7
			new RowDefinition { Height = new GridLength (30) },	// Row 7-8
			new RowDefinition { Height = new GridLength (30) },	// Row 8-9
			new RowDefinition { Height = new GridLength (30) },	// Row 9-10
			new RowDefinition { Height = new GridLength (30) },	// Row 10-11
			new RowDefinition (),	// Row 11-12
			new RowDefinition (),	// Row 12-13
		};
		ColumnDefinitions = new ColumnDefinitionCollection {
			new ColumnDefinition { Width = new GridLength (5) },	// Column 0-1
			new ColumnDefinition { Width = new GridLength (10) },	// Column 1-2
			new ColumnDefinition (),							// Column 2-3
			new ColumnDefinition (),							// Column 3-4
			new ColumnDefinition (),							// Column 4-5
			new ColumnDefinition { Width = new GridLength (10) },	// Column 5-6
			new ColumnDefinition { Width = new GridLength (5) },	// Column 6-7
		};
		// Specify in format (column start, column end, row start, row end);
		Children.Add (loginSquare, 1, 6, 4, 12);
		Children.Add (label1, 2, 6, 1, 2);
		Children.Add (label2, 2, 6, 2, 3);
		Children.Add (bolettaImage, 2, 3, 5, 7);
		Children.Add (label3, 3, 6, 5, 6);
		Children.Add (label4, 3, 6, 6, 7);
		Children.Add (label5, 2, 6, 7, 8);
		Children.Add (usernameEntry, 2, 5, 8, 9);
		Children.Add (passwordEntry, 2, 5, 9, 10);
		Children.Add (buttonForgotPass, 3, 4, 10, 11);
		Children.Add (buttonSignIn, 4, 5, 10, 11);
	}