Example #1
0
        public void TestMarginLayout1()
        {
            var root = new VisualElement();

            root.Styles.Layout = new LayoutStyle {
                Type = LayoutType.Row
            };
            root.Styles.Background = new BackgroundStyle {
                Color = Color.WhiteSmoke
            };

            var el1 = new VisualElement();

            el1.Styles.Width      = new SizeStyle("200px");
            el1.Styles.Height     = new SizeStyle("100px");
            el1.Styles.Margin     = new MarginStyle("10px");
            el1.Styles.Background = new BackgroundStyle {
                Color = Color.Red
            };

            var el2 = new VisualElement();

            el2.Styles.Width      = new SizeStyle("1*");
            el2.Styles.Height     = new SizeStyle("300px");
            el2.Styles.Margin     = new MarginStyle("10px 50px");
            el2.Styles.Background = new BackgroundStyle {
                Color = Color.Blue
            };

            root.AddChildren(el1, el2);

            AssertVisual("844d7bbaa2fb7e684aeeb9e4fa8dd7b8", root);
        }
Example #2
0
        private VisualElement GetTestLayout(SizeStyle width, SizeStyle height)
        {
            var root = new VisualElement();

            root.Styles.Layout = new LayoutStyle {
                Type = LayoutType.Row
            };
            root.Styles.Background = new BackgroundStyle {
                Color = Color.WhiteSmoke
            };

            var el1 = new VisualElement();

            el1.Styles.Width      = width;
            el1.Styles.Height     = height;
            el1.Styles.Background = new BackgroundStyle {
                Color = Color.Red
            };

            root.AddChildren(el1);

            return(root);
        }
Example #3
0
        public void TestMarginLayout2()
        {
            var root = new VisualElement();

            root.Styles.Layout = new LayoutStyle {
                Type = LayoutType.Row
            };
            root.Styles.Background = new BackgroundStyle {
                Color = Color.WhiteSmoke
            };

            var el1 = new VisualElement();

            el1.Styles.Width      = new SizeStyle("200px");
            el1.Styles.Height     = new SizeStyle("100px");
            el1.Styles.Margin     = new MarginStyle("50%");
            el1.Styles.Background = new BackgroundStyle {
                Color = Color.Red
            };

            root.AddChildren(el1);

            AssertVisual("427eb920da121a828eb5e506f1eb45c2", root);
        }
Example #4
0
        public void TestRow()
        {
            var root = new VisualElement();

            root.Styles.Layout = new LayoutStyle {
                Type = LayoutType.Row
            };
            root.Styles.Background = new BackgroundStyle {
                Color = Color.Aqua
            };

            var el1 = new VisualElement();

            el1.Styles.Width      = new SizeStyle("200px");
            el1.Styles.Height     = new SizeStyle("200px");
            el1.Styles.Background = new BackgroundStyle {
                Color = Color.Red
            };

            var el2 = new VisualElement();

            el2.Styles.Layout = new LayoutStyle {
                Type = LayoutType.Column
            };
            el2.Styles.Width      = new SizeStyle("1*");
            el2.Styles.Height     = new SizeStyle("300px");
            el2.Styles.Background = new BackgroundStyle {
                Color = Color.Blue
            };

            var el3 = new VisualElement();

            el3.Styles.Width      = new SizeStyle("1*");
            el3.Styles.Height     = new SizeStyle("200px");
            el3.Styles.Background = new BackgroundStyle {
                Color = Color.Green
            };

            var el4 = new VisualElement();

            el4.Styles.Width      = new SizeStyle("100px");
            el4.Styles.Height     = new SizeStyle("200px");
            el4.Styles.Background = new BackgroundStyle {
                Color = Color.Black
            };

            var sel1 = new VisualElement();

            sel1.Styles.Width      = new SizeStyle("50px");
            sel1.Styles.Height     = new SizeStyle("50px");
            sel1.Styles.Background = new BackgroundStyle {
                Color = Color.Gray
            };

            var sel2 = new VisualElement();

            sel2.Styles.Width      = new SizeStyle("50px");
            sel2.Styles.Height     = new SizeStyle("1*");
            sel2.Styles.Background = new BackgroundStyle {
                Color = Color.GreenYellow
            };

            el2.AddChildren(sel1, sel2);
            root.AddChildren(el1, el2, el3, el4);

            AssertVisual("781d03724ac9caab1c140b3729ffccd6", root);
        }