Exemplo n.º 1
0
        private void UniformGridDO_Click(object sender, RoutedEventArgs e)
        {
            if (TargetPanel.LayoutDefinitions[0] is UniformGridLayout)
            {
                UniformGridLayout ugl = (UniformGridLayout)TargetPanel.LayoutDefinitions[0];

                if (ugl.Columns != 10)
                {
                    ugl.Columns = 10;
                }
                else
                {
                    ugl.Columns = 0;
                }

                if (ugl.Rows != 10)
                {
                    ugl.Rows = 10;
                }
                else
                {
                    ugl.Rows = 0;
                }

                if (ugl.FirstColumn != 5)
                {
                    ugl.FirstColumn = 5;
                }
                else
                {
                    ugl.FirstColumn = 0;
                }
            }
        }
 /// <summary>
 /// Initialize a new instance of the MetaUniformGridPanel class.
 /// </summary>
 public MetaUniformGridPanel()
 {
     UniformGridLayout layout = new UniformGridLayout();
     layout.SetBinding(UniformGridLayout.RowsProperty, ThisBinding("Rows"));
     layout.SetBinding(UniformGridLayout.ColumnsProperty, ThisBinding("Columns"));
     layout.SetBinding(UniformGridLayout.FirstColumnProperty, ThisBinding("FirstColumn"));
     Layouts.Add(layout);
 }
Exemplo n.º 3
0
        public void VerifySwitchingLayoutDynamically()
        {
            LayoutPanel panel   = null;
            Button      button1 = null;
            Button      button2 = null;

            RunOnUIThread.Execute(() =>
            {
                Log.Comment("Create LayoutPanel with StackLayout");

                panel = new LayoutPanel()
                {
                    Width = 400, Height = 400
                };

                var stackLayout = new StackLayout
                {
                    Orientation = Orientation.Vertical
                };
                panel.Layout = stackLayout;

                button1 = new Button {
                    Height = 100, Content = "1"
                };
                button2 = new Button {
                    Height = 100, Content = "2"
                };
                panel.Children.Add(button1);
                panel.Children.Add(button2);

                Content = panel;
                Content.UpdateLayout();

                Log.Comment("Verify layout for StackLayout:");
                Verify.AreEqual(new Rect(0, 0, 400, 100), LayoutInformation.GetLayoutSlot(button1), "Verify LayoutSlot of child 1");
                Verify.AreEqual(new Rect(0, 100, 400, 100), LayoutInformation.GetLayoutSlot(button2), "Verify LayoutSlot of child 2");
            });

            IdleSynchronizer.Wait();

            RunOnUIThread.Execute(() =>
            {
                Log.Comment("Switch LayoutPanel to UniformGridLayout");
                UniformGridLayout gridLayout = new UniformGridLayout();
                gridLayout.MinItemWidth      = 100;
                gridLayout.MinItemHeight     = 100;
                panel.Layout = gridLayout;

                Content.UpdateLayout();

                Log.Comment("Verify layout for UniformGridLayout:");
                Verify.AreEqual(new Rect(0, 0, 100, 100), LayoutInformation.GetLayoutSlot(button1), "Verify LayoutSlot of child 1");
                Verify.AreEqual(new Rect(100, 0, 100, 100), LayoutInformation.GetLayoutSlot(button2), "Verify LayoutSlot of child 2");
            });
        }
Exemplo n.º 4
0
        public ItemsRepeaterPage()
        {
            InitializeComponent();
            VerticalStackLayout   = (StackLayout)Resources[nameof(VerticalStackLayout)];
            HorizontalStackLayout = (StackLayout)Resources[nameof(HorizontalStackLayout)];
            UniformGridLayout     = (UniformGridLayout)Resources[nameof(UniformGridLayout)];

            InitializeData();
            repeater2.ItemsSource = Enumerable.Range(0, 500);
            repeater.ItemsSource  = BarItems;
        }