Пример #1
0
        public SampleViewController4()
        {
            var box1 = Make_Box(UIColor.Blue, 75, 20);
            var box2 = Make_Box(UIColor.Yellow, 50, 50);
            var box3 = Make_Box(UIColor.Red, 25, 50);
            var box4 = Make_Box(UIColor.Green, 25, 50);
            var box5 = Make_Box(UIColor.Orange, 25, 25);

            var layout = new Grid.Layout()
                         .WithColumns(-1, -1, -1)
                         .WithRows(-1, -1)
                         + box1.At(0, 0).ColSpan(2)
                         + box2.At(0, 2)
                         + box3.At(1, 0)
                         + box4.At(1, 1)
                         + box5.At(1, 2)
            ;
            var grid = new Grid(layout);

            grid.Frame           = new CGRect(0, 100, 0, 0);
            grid.BackgroundColor = UIColor.DarkGray;
            grid.LayoutSubviews();

            Add(grid);
        }
Пример #2
0
        public SampleViewController5()
        {
            var blue   = Make_Box(UIColor.Blue, 50, 20);
            var yellow = Make_Box(UIColor.Yellow, 0, 50);
            var red    = Make_Box(UIColor.Red, 0, 25);
            var green  = Make_Box(UIColor.Green, 0, 100);
            var orange = Make_Box(UIColor.Orange, 25, 25);

            var layout = new Grid.Layout()
                         .WithColumns(0.25f, 0.25f, 0.5f)
                         .WithRows(-1, -1)
                         + blue.At(0, 0).ColSpan(2).Tag("blue")
                         + yellow.At(0, 2).AlignStretch(Grid.Layout.Direction.Horizontal).Tag("yellow")
                         + red.At(1, 0).AlignStretch(Grid.Layout.Direction.Horizontal).Tag("red")
                         + green.At(1, 1).AlignStretch(Grid.Layout.Direction.Horizontal).Tag("green")
                         + orange.At(1, 2).Tag("orange")
            ;
            var grid = new Grid(layout);

            grid.AutoWidth       = false;                                   // Cannot be used w/ %-based column spec
            grid.AutoHeight      = true;
            grid.Frame           = new CGRect(0, 100, View.Frame.Width, 0); // No need to specify height: calculated/set
            grid.BackgroundColor = UIColor.DarkGray;
            grid.LayoutSubviews();

            Add(grid);
        }
Пример #3
0
        public SampleViewController2()
        {
            var time = Make_Box(UIColor.Blue, 200, 50);
            var p    = Make_Box(UIColor.Yellow, 30, 15);
            var m    = Make_Box(UIColor.Red, 30, 15);

            var layout = new Grid.Layout()
                         .WithRows(0.5f, 0.5f)
                         .WithColumns(-1, -1)
                         + time.At(0, 0).RowSpan(2)
                         + p.At(0, 1).Vertically(Grid.Layout.Alignment.Start)
                         + m.At(1, 1).Vertically(Grid.Layout.Alignment.End);
            var grid = new Grid(layout);

            grid.Frame           = new CGRect(0, 100, 0, 0);
            grid.BackgroundColor = UIColor.DarkGray;
            grid.LayoutSubviews();

            Add(grid);
        }
Пример #4
0
        public SampleViewController7()
        {
            float width   = 200;
            float padding = 10;

            var blue = Make_Box(UIColor.Blue, 0, 100);

            var layout = new Grid.Layout()
                         + blue.AddStackRow(width - padding * 2).Horizontally(Grid.Layout.Alignment.Stretched)
            ;

            layout.Padding = new Grid.Insets(10);
            var grid = new Grid(layout);

            grid.Frame           = new CGRect(100, 100, width, 0);
            grid.BackgroundColor = UIColor.Gray;
            grid.AutoWidth       = false;
            grid.AutoHeight      = true;

            Add(grid);
        }
Пример #5
0
        public SampleViewController6()
        {
            var blue   = Make_Box(UIColor.Blue, 200, 100);
            var yellow = Make_Box(UIColor.Yellow, 100, 50);

            var layout = new Grid.Layout()
                         + blue.AddStackRow()
                         + yellow.AddStackRow().Horizontally(Grid.Layout.Alignment.Center)
            ;

            layout.Padding = new Grid.Insets(10, 25, 5, 50);
            var innerGrid = new Grid(layout);

            innerGrid.BackgroundColor = UIColor.LightGray;

            var frame     = new CGRect(0, 200, View.Frame.Width, View.Frame.Width);
            var outerGrid = Grid.CreateAutoCenterGrid(innerGrid, frame);

            outerGrid.BackgroundColor = UIColor.DarkGray;

            Add(outerGrid);
        }
Пример #6
0
        public SampleViewController3()
        {
            var box1 = Make_Box(UIColor.Blue, 200, 50);

            box2 = Make_Box(UIColor.Yellow, 100, 50);
            var box3 = Make_Box(UIColor.Red, 200, 50);
            var box4 = Make_Box(UIColor.Green, 200, 50);

            var layout = new Grid.Layout()
                         + box1.AddStackRow()
                         + box2.AddStackRow().MarginTop(60).MarginLeft(20).MarginBottom(40)
                         + box3.AddStackRow()
                         + box4.AddStackRow()
            ;

            layout.Spacing = 10;
            var grid = new Grid(layout);

            grid.Frame           = new CGRect(0, 100, 0, 0);
            grid.BackgroundColor = UIColor.DarkGray;
            grid.LayoutSubviews();

            Add(grid);
        }