Esempio n. 1
0
 public void Deactivate()
 {
     window.Remove(rootView);
     rootView.Dispose();
     rootView = null;
     window   = null;
 }
Esempio n. 2
0
        public void ScrollableBaseScrollTo()
        {
            tlog.Debug(tag, $"ScrollableBaseScrollTo START");

            var testingTarget = new ScrollableBase()
            {
                Size               = new Size(100, 2),
                BackgroundColor    = Color.Cyan,
                ScrollingDirection = ScrollableBase.Direction.Horizontal,
            };

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <ScrollableBase>(testingTarget, "Should return ScrollableBase instance.");

            try
            {
                testingTarget.ScrollTo(0.3f, true);
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"ScrollableBaseScrollTo END (OK)");
        }
        void Initialize()
        {
            ScrollableBase scrollableBase = new ScrollableBase();

            scrollableBase.Size = new Size(720, 1280);
            scrollableBase.ScrollingDirection = ScrollableBase.Direction.Vertical;
            Window.Instance.GetDefaultLayer().Add(scrollableBase);

            scrollableBase.ScrollDragStarted += ScrollDragStarted;
            scrollableBase.ScrollDragEnded   += ScrollDragEnded;

            View[] items;
            items = new View[10];
            for (int i = 0; i < items.Length; i++)
            {
                items[i] = new View
                {
                    Position = new Position(0, i * 200),
                    Size     = new Size(720, 200),
                };
                if (i % 2 == 0)
                {
                    items[i].BackgroundColor = Color.Magenta;
                }
                else
                {
                    items[i].BackgroundColor = Color.Cyan;
                }
                scrollableBase.Add(items[i]);
            }
        }
Esempio n. 4
0
        public void ScrollableBaseOnAccessibilityPan()
        {
            tlog.Debug(tag, $"ScrollableBaseOnAccessibilityPan START");

            var testingTarget = new ScrollableBase()
            {
                Size               = new Size(100, 2),
                BackgroundColor    = Color.Cyan,
                ScrollingDirection = ScrollableBase.Direction.Vertical,
            };

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <ScrollableBase>(testingTarget, "Should return ScrollableBase instance.");

            using (PanGesture gesture = new PanGesture())
            {
                try
                {
                    testingTarget.OnAccessibilityPan(gesture);
                }
                catch (Exception e)
                {
                    tlog.Debug(tag, e.Message.ToString());
                    Assert.Fail("Caught Exception : Failed!");
                }
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"ScrollableBaseOnAccessibilityPan END (OK)");
        }
    protected override void OnCreate()
    {
        base.OnCreate();

        var window       = NUIApplication.GetDefaultWindow();
        var screenLength = Math.Min(window.Size.Width, window.Size.Height);

        var view = new ImageView()
        {
            Size        = new Size(360, 1440),
            ResourceUrl = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/image.jpg",
            Focusable   = true,
        };

        scrollableBase = new ScrollableBase()
        {
            Size          = new Size(360, 360),
            HideScrollbar = false,
            Scrollbar     = new Scrollbar()
            {
                TrackColor   = Color.Blue,
                ThumbColor   = new Color(1.0f, 0.0f, 0.0f, 0.5f),
                TrackPadding = new Extents(24, 24, 40, 40)
            }
        };
        scrollableBase.Add(view);

        window.Add(scrollableBase);
    }
        public PerformanceTest3Page()
        {
            InitializeComponent();

            //Application Linear Layout
            LinearLayout layout = new LinearLayout();

            layout.LinearOrientation = LinearLayout.Orientation.Vertical;
            layout.LinearAlignment   = LinearLayout.Alignment.Center;
            layout.Padding           = new Extents(5, 5, 5, 5);
            layout.CellPadding       = new Size2D(5, 5);
            this.Layout = layout;

            LinearLayout hLayout = new LinearLayout();

            hLayout.LinearOrientation = LinearLayout.Orientation.Horizontal;
            hLayout.LinearAlignment   = LinearLayout.Alignment.Center;
            hLayout.Padding           = new Extents(5, 5, 5, 5);
            hLayout.CellPadding       = new Size2D(5, 5);
            ButtonBox.Layout          = hLayout;


            ScrollBegin.Clicked  += OnScrollBeginClicked;
            ScrollMiddle.Clicked += OnScrollMiddleClicked;
            ScrollEnd.Clicked    += OnScrollEndClicked;

            //Create List for Labels
            LabelsListView = new ScrollableBase();
            LabelsListView.BackgroundColor = Color.White;
            LabelsListView.Size2D          = new Size2D(700, 1200);

            //Set linead layout for scrollable widget
            LinearLayout scrollLayout = new LinearLayout();

            scrollLayout.LinearOrientation = LinearLayout.Orientation.Vertical;
            scrollLayout.LinearAlignment   = LinearLayout.Alignment.Center;
            scrollLayout.CellPadding       = new Size2D(5, 5);
            LabelsListView.Layout          = scrollLayout;
            LabelsListView.ScrollDuration  = ScrollTime;
            this.Add(LabelsListView);

            var items = new ListItemTitleView[TestItems];

            for (int i = 0; i < TestItems; i++)
            {
                items[i] = new ListItemTitleView("item: " + i.ToString());
                LabelsListView.Add(items[i]);
            }
        }
Esempio n. 7
0
        public void CreatePage()
        {
            scrollable = new ScrollableBase()
            {
                Size       = new Size(360, 360),
                SnapToPage = true,

                ScrollingDirection     = ScrollableBase.Direction.Horizontal,
                ParentOrigin           = ParentOrigin.Center,
                PivotPoint             = PivotPoint.Center,
                PositionUsesPivotPoint = true,
            };

            View view = new View()
            {
                WidthSpecification  = LayoutParamPolicies.WrapContent,
                HeightSpecification = 360,
                Layout = new LinearLayout()
                {
                    LinearOrientation   = LinearLayout.Orientation.Horizontal,
                    SetPositionByLayout = false,
                },
                BackgroundColor = new Color(0.15f, 0.15f, 0.15f, 1.0f),
            };

            scrollable.Add(view);

            List <string> appList = WidgetApplicationInfo.LoadAllParameters();

            for (int i = 0; i < appStr.Count; i++)
            {
                ImageView viewer = new ImageView()
                {
                    Name = appList[i],
                    //ParentOrigin = ParentOrigin.Center,
                    //PivotPoint = PivotPoint.Center,
                    //PositionUsesPivotPoint = true,
                    Size            = new Size(360, 360),
                    CornerRadius    = 180.0f,
                    Scale           = new Vector3(0.6f, 0.6f, 0.6f),
                    BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "widget_capture/" + appStr[i],
                };
                viewer.TouchEvent += Viewer_TouchEvent;

                view.Add(viewer);
            }
        }
Esempio n. 8
0
        public void ScrollableBaseFadeScrollbar()
        {
            tlog.Debug(tag, $"ScrollableBaseFadeScrollbar START");

            var testingTarget = new ScrollableBase();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <ScrollableBase>(testingTarget, "Should return ScrollableBase instance.");

            testingTarget.FadeScrollbar = false;
            Assert.AreEqaul(false, testingTarget.FadeScrollbar, "Should be equal.");

            testingTarget.FadeScrollbar = true;
            Assert.AreEqaul(true, testingTarget.FadeScrollbar, "Should be equal.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ScrollableBaseFadeScrollbar END (OK)");
        }
Esempio n. 9
0
        public void ScrollableBaseStepScrollDistance()
        {
            tlog.Debug(tag, $"ScrollableBaseStepScrollDistance START");

            var testingTarget = new ScrollableBase();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <ScrollableBase>(testingTarget, "Should return ScrollableBase instance.");

            testingTarget.StepScrollDistance = 200f;
            tlog.Debug(tag, "StepScrollDistance : " + testingTarget.StepScrollDistance);

            testingTarget.StepScrollDistance = 0f;
            tlog.Debug(tag, "StepScrollDistance : " + testingTarget.StepScrollDistance);

            testingTarget.Dispose();
            tlog.Debug(tag, $"ScrollableBaseStepScrollDistance END (OK)");
        }
Esempio n. 10
0
        public void ScrollableBaseScrollEnabled()
        {
            tlog.Debug(tag, $"ScrollableBaseScrollEnabled START");

            var testingTarget = new ScrollableBase();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <ScrollableBase>(testingTarget, "Should return ScrollableBase instance.");

            testingTarget.ScrollEnabled = true;
            tlog.Debug(tag, "ScrollEnabled : " + testingTarget.ScrollEnabled);

            testingTarget.ScrollEnabled = false;
            tlog.Debug(tag, "ScrollEnabled : " + testingTarget.ScrollEnabled);

            testingTarget.ScrollEnabled = true;
            tlog.Debug(tag, "ScrollEnabled : " + testingTarget.ScrollEnabled);

            testingTarget.Dispose();
            tlog.Debug(tag, $"ScrollableBaseScrollEnabled END (OK)");
        }
Esempio n. 11
0
    public override void OnCreate(View root)
    {
        var addButton = new Button()
        {
            Text = "Add", Size = new Size(100, 50), PointSize = 10
        };

        addButton.Clicked += OnAddButtonClicked;
        root.Add(addButton);

        var removeButton = new Button()
        {
            Text = "Remove", Size = new Size(100, 50), PointSize = 10, ParentOrigin = ParentOrigin.TopRight, PivotPoint = PivotPoint.TopRight, PositionUsesPivotPoint = true
        };

        removeButton.Clicked += OnRemoveButtonClicked;
        root.Add(removeButton);

        scrollable = new ScrollableBase()
        {
            Size                   = new Size(360, 360),
            ParentOrigin           = ParentOrigin.Center,
            PivotPoint             = PivotPoint.Center,
            PositionUsesPivotPoint = true,
            Layout                 = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Vertical
            },
            HideScrollbar = false,
            Scrollbar     = new Scrollbar()
            {
                // TrackColor = Color.Blue,
                // ThumbColor = new Color(1.0f, 0.0f, 0.0f, 0.5f),
                TrackPadding = new Extents(24, 24, 40, 40)
            }
        };
        root.Add(scrollable);

        OnAddButtonClicked(null, null);
    }
Esempio n. 12
0
        /// Modify this method for adding other examples.
        public DefaultGridItemExample() : base()
        {
            Log.Info(this.GetType().Name, $"{this.GetType().Name} is contructed\n");

            WidthSpecification  = LayoutParamPolicies.MatchParent;
            HeightSpecification = LayoutParamPolicies.MatchParent;
            // Navigator bar title is added here.
            AppBar = new AppBar()
            {
                Title = "DefaultLinearItem Style",
            };

            // Example root content view.
            // you can decorate, add children on this view.
            var rootContent = new ScrollableBase()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                ScrollingDirection  = ScrollableBase.Direction.Vertical,
                HideScrollbar       = false,
                Layout = new LinearLayout()
                {
                    LinearOrientation   = LinearLayout.Orientation.Vertical,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    CellPadding         = new Size2D(0, 20),
                },
            };

            var path = Tizen.Applications.Application.Current.DirectoryInfo.Resource;

            CreateItems(rootContent, 114, 114, path + "/images/grid_01.jpg");
            CreateItems(rootContent, 114, 114, path + "/images/grid_01.jpg", "Small");
            CreateItems(rootContent, 138, 138, path + "/images/grid_02.jpg");
            CreateItems(rootContent, 138, 138, path + "/images/grid_02.jpg", "Medium");
            CreateItems(rootContent, 252, 252, path + "/images/grid_03.jpg");
            CreateItems(rootContent, 252, 252, path + "/images/grid_03.jpg", "Large");

            Content = rootContent;
        }
Esempio n. 13
0
        void CreateItems(View parent, int width, int height, string resource = null, string text = null)
        {
            var horizBox = new ScrollableBase()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = height + 30,
                ScrollingDirection  = ScrollableBase.Direction.Horizontal,
                HideScrollbar       = false,
                Layout = new LinearLayout()
                {
                    LinearOrientation   = LinearLayout.Orientation.Horizontal,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    CellPadding         = new Size2D(10, 0),
                },
            };

            var enabledItem = CreateItem(width, height, null, text);

            horizBox.Add(enabledItem);

            var disabledItem = CreateItem(width, height, null, text);

            disabledItem.IsEnabled = false;
            horizBox.Add(disabledItem);

            var selectedItem = CreateItem(width, height, null, text);

            selectedItem.IsSelectable = true;
            selectedItem.IsSelected   = true;
            horizBox.Add(selectedItem);

            var imageItem = CreateItem(width, height, resource, text);

            horizBox.Add(imageItem);


            parent.Add(horizBox);
        }
Esempio n. 14
0
        public void ScrollableBaseConstructor()
        {
            tlog.Debug(tag, $"ScrollableBaseConstructor START");

            var testingTarget = new ScrollableBase();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <ScrollableBase>(testingTarget, "Should return ScrollableBase instance.");

            tlog.Debug(tag, "ScrollPosition : " + testingTarget.ScrollPosition);

            testingTarget.ScrollingEventThreshold = 0.3f;
            tlog.Debug(tag, "ScrollingEventThreshold : " + testingTarget.ScrollingEventThreshold);

            testingTarget.NoticeAnimationEndBeforePosition = 0.5f;
            tlog.Debug(tag, "NoticeAnimationEndBeforePosition : " + testingTarget.NoticeAnimationEndBeforePosition);

            testingTarget.Padding = new Extents(2, 2, 2, 2);
            tlog.Debug(tag, "Padding : " + testingTarget.Padding);

            testingTarget.Dispose();
            tlog.Debug(tag, $"ScrollableBaseConstructor END (OK)");
        }
Esempio n. 15
0
        /// Modify this method for adding other examples.
        public DefaultLinearItemExample() : base()
        {
            Log.Info(this.GetType().Name, $"{this.GetType().Name} is contructed\n");

            WidthSpecification  = LayoutParamPolicies.MatchParent;
            HeightSpecification = LayoutParamPolicies.MatchParent;
            // Navigator bar title is added here.
            AppBar = new AppBar()
            {
                Title = "DefaultLinearItem Style",
            };

            // Example root content view.
            // you can decorate, add children on this view.
            var rootContent = new ScrollableBase()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                ScrollingDirection  = ScrollableBase.Direction.Vertical,
                HideScrollbar       = false,
                Layout = new LinearLayout()
                {
                    LinearOrientation   = LinearLayout.Orientation.Vertical,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    CellPadding         = new Size2D(10, 20),
                },
            };

            CreateItems(rootContent, "Label Only");
            CreateItems(rootContent, "Label and SubLabel", "Lorem ipsum dolor sit amet, consectetur adipiscing elit");
            CreateItems(rootContent, "Label and Icon", null, true);
            CreateItems(rootContent, "Label and Extra", null, false, true);

            Content = rootContent;
        }
Esempio n. 16
0
        public void ScrollableBaseScrollbar()
        {
            tlog.Debug(tag, $"ScrollableBaseScrollbar START");

            var testingTarget = new ScrollableBase();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <ScrollableBase>(testingTarget, "Should return ScrollableBase instance.");

            testingTarget.ScrollEnabled = true;
            tlog.Debug(tag, "ScrollEnabled : " + testingTarget.ScrollEnabled);

            testingTarget.HideScrollbar = false;

            Scrollbar bar = new Scrollbar()
            {
                Size = new Size(50, 2),
            };

            testingTarget.Scrollbar = bar;

            testingTarget.Dispose();
            tlog.Debug(tag, $"ScrollableBaseScrollbar END (OK)");
        }
        public ScrollableBaseDirectionExample(string dir)  : base()
        {
            Log.Info(this.GetType().Name, $"{this.GetType().Name} is contructed\n");

            WidthSpecification  = LayoutParamPolicies.MatchParent;
            HeightSpecification = LayoutParamPolicies.MatchParent;

            bool isHorizontal = (dir == "Horizontal");

            // Navigator bar title is added here.
            AppBar = new AppBar()
            {
                Title = "ScrollableBase " + dir + " Style",
            };

            // Example root content view.
            // you can decorate, add children on this view.
            var scrollView = new ScrollableBase()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                HideScrollbar       = false,
            };

            // FIXME: should work focus on ScrollableBase.
            // scrollView.EnableFocus();

            if (isHorizontal)
            {
                scrollView.ScrollingDirection = ScrollableBase.Direction.Horizontal;
                scrollView.Layout             = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    VerticalAlignment = VerticalAlignment.Center,
                    CellPadding       = new Size2D(10, 10),
                };
            }
            else
            {
                scrollView.ScrollingDirection = ScrollableBase.Direction.Vertical;
                scrollView.Layout             = new LinearLayout()
                {
                    LinearOrientation   = LinearLayout.Orientation.Vertical,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    CellPadding         = new Size2D(10, 10),
                };
            }

            Random rnd = new Random();

            for (int i = 0; i < SCROLLMAX; i++)
            {
                var colorView = new View();
                colorView.WidthSpecification  = (isHorizontal? 200 : LayoutParamPolicies.MatchParent);
                colorView.HeightSpecification = (isHorizontal? LayoutParamPolicies.MatchParent : 200);
                colorView.BackgroundColor     = new Color((float)rnd.Next(256) / 256f, (float)rnd.Next(256) / 256f, (float)rnd.Next(256) / 256f, 1);
                colorView.EnableFocus();
                scrollView.Add(colorView);
            }

            Content = scrollView;
        }
Esempio n. 18
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            FocusManager.Instance.EnableDefaultAlgorithm(true);

            root        = new View();
            root.Layout = new AbsoluteLayout();
            root.Size   = new Size(300, 800);

            var scrollview = new ScrollableBase {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                ScrollingDirection  = ScrollableBase.Direction.Vertical,
                Focusable           = true,
                FocusableInTouch    = true,
            };

            root.Add(scrollview);

            scrollview.ContentContainer.Layout = new LinearLayout
            {
                LinearOrientation = LinearLayout.Orientation.Vertical
            };

            scrollview.ContentContainer.Add(new View
            {
                BackgroundColor   = new Vector4(1.0f, 0.6f, 0.2f, 1.0f),
                SizeHeight        = 100,
                WidthResizePolicy = ResizePolicyType.FillToParent,
            });

            var scroll2 = new ScrollableBase {
                BackgroundColor    = Color.Gray,
                ScrollingDirection = ScrollableBase.Direction.Vertical,
                Focusable          = true,
                FocusableInTouch   = true,
            };

            scroll2.WidthSpecification  = LayoutParamPolicies.MatchParent;
            scroll2.HeightSpecification = LayoutParamPolicies.MatchParent;
            scroll2.WidthResizePolicy   = ResizePolicyType.FillToParent;
            scroll2.SizeHeight          = 400;

            var abscontainer = new View
            {
                Layout             = new AbsoluteLayout(),
                WidthSpecification = LayoutParamPolicies.MatchParent,
                SizeHeight         = 400,
            };

            abscontainer.Add(scroll2);

            scrollview.ContentContainer.Add(abscontainer);

            scroll2.ContentContainer.Layout = new LinearLayout
            {
                LinearOrientation = LinearLayout.Orientation.Vertical
            };

            for (int i = 0; i < 50; i++)
            {
                scroll2.ContentContainer.Add(new TextLabel
                {
                    Text = $"Text {i}",
                    WidthResizePolicy = ResizePolicyType.FillToParent,
                    Focusable         = true,
                    FocusableInTouch  = true,
                    // Position = new Position(0, i*50+200),
                });
            }

            scrollview.ContentContainer.Add(new View {
                BackgroundColor   = Color.Yellow,
                SizeHeight        = 400,
                WidthResizePolicy = ResizePolicyType.FillToParent,
            });

            TextLabel titleView = new TextLabel
            {
                Text             = "Title",
                Focusable        = true,
                FocusableInTouch = true,
                Size             = new Size(300, 100),
            };

            TextLabel footView = new TextLabel
            {
                Text             = "Foot",
                Focusable        = true,
                FocusableInTouch = true,
                Size             = new Size(300, 100),
                Position         = new Position(0, 500),
            };

            window.Add(root);
            window.Add(titleView);
            window.Add(footView);
        }
Esempio n. 19
0
        public MainPage() : base()
        {
            ScrollableBase infoScroll = new ScrollableBase()
            {
                ScrollingDirection = ScrollableBase.Direction.Vertical,
                Size   = new Size(Size),
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                },
            };

            Add(infoScroll);

            infoScroll.ContentContainer.Padding = new Extents(0, 0, 80, 0);

            List <object> dummyData = ItemData.CreateDummyItemData(50);
            Random        r         = new Random();

            foreach (ItemData data in dummyData)
            {
                View item = new View()
                {
                    Size   = new Size(Size.Width, 260),
                    Layout = new LinearLayout()
                    {
                        LinearOrientation = LinearLayout.Orientation.Vertical,
                    },
                    Padding = new Extents(15, 15, 0, 0),
                    Margin  = new Extents(0, 0, 15, 0),
                };
                infoScroll.Add(item);

                View mainInformation = new View()
                {
                    WidthSpecification  = LayoutParamPolicies.MatchParent,
                    HeightSpecification = 200,
                    Layout = new LinearLayout()
                    {
                        LinearOrientation = LinearLayout.Orientation.Horizontal,
                    }
                };
                item.Add(mainInformation);

                ImageView itemImage = new ImageView()
                {
                    Size            = new Size(200, 200),
                    ResourceUrl     = "./res/images/" + data.ImageUrl,
                    DesiredWidth    = 200,
                    DesiredHeight   = 200,
                    BackgroundColor = new Color("#f0f0f0"),
                };
                mainInformation.Add(itemImage);

                View detailInformation = new View()
                {
                    WidthSpecification  = 250,
                    HeightSpecification = 200,
                    Layout = new LinearLayout()
                    {
                        LinearOrientation = LinearLayout.Orientation.Vertical,
                    }
                };
                mainInformation.Add(detailInformation);

                View details = new View()
                {
                    WidthSpecification  = LayoutParamPolicies.MatchParent,
                    HeightSpecification = 160,
                    Layout = new LinearLayout()
                    {
                        LinearOrientation = LinearLayout.Orientation.Vertical,
                    }
                };
                detailInformation.Add(details);

                TextLabel itemName = new TextLabel()
                {
                    Text = data.Name,
                    WidthSpecification = LayoutParamPolicies.MatchParent,
                    MultiLine          = true,
                    PixelSize          = 16,
                    Margin             = new Extents(15, 15, 15, 15)
                };
                details.Add(itemName);

                TextLabel itemPrice = new TextLabel()
                {
                    Text = data.Price,
                    WidthSpecification = LayoutParamPolicies.MatchParent,
                    PixelSize          = 24,
                    Margin             = new Extents(15, 15, 0, 0)
                };
                details.Add(itemPrice);

                detailInformation.Add(new View()
                {
                    WidthSpecification  = LayoutParamPolicies.MatchParent,
                    HeightSpecification = 1,
                    BackgroundColor     = new Color("#f0f0f0"),
                });

                View icons = new View()
                {
                    WidthSpecification  = LayoutParamPolicies.MatchParent,
                    HeightSpecification = 40,
                    Layout = new FlexLayout()
                    {
                        Direction      = FlexLayout.FlexDirection.Row,
                        ItemsAlignment = FlexLayout.AlignmentType.Center,
                        Justification  = FlexLayout.FlexJustification.FlexEnd,
                    },
                };
                detailInformation.Add(icons);

                ImageView heart = new ImageView()
                {
                    Size        = new Size(40, 32),
                    ResourceUrl = "./res/images/" + (r.Next(0, 10) % 2 == 0 ? "heart.png" : "heart_selected.png"),
                    FittingMode = FittingModeType.ScaleToFill,
                    Margin      = new Extents(0, 10, 0, 0)
                };
                icons.Add(heart);

                ImageView cart = new ImageView()
                {
                    Size        = new Size(40, 40),
                    ResourceUrl = "./res/images/cart.svg",
                    FittingMode = FittingModeType.ScaleToFill
                };
                icons.Add(cart);

                detailInformation.Add(new View()
                {
                    WidthSpecification  = LayoutParamPolicies.MatchParent,
                    HeightSpecification = 1,
                    BackgroundColor     = new Color("#f0f0f0"),
                });

                View additionalInformation = new View()
                {
                    WidthSpecification  = LayoutParamPolicies.MatchParent,
                    HeightSpecification = 60,
                    Layout = new LinearLayout()
                    {
                        LinearOrientation = LinearLayout.Orientation.Horizontal,
                        CellPadding       = new Size2D(15, 15),
                        LinearAlignment   = LinearLayout.Alignment.CenterVertical,
                    },
                };
                item.Add(additionalInformation);

                TextLabel point = new TextLabel()
                {
                    Text      = "☆ " + ((float)r.Next(30, 50) / 10.0f) + "점",
                    PixelSize = 16.0f,
                };
                additionalInformation.Add(point);

                TextLabel views = new TextLabel()
                {
                    Text      = (r.Next(300, 4000)) + "건",
                    PixelSize = 16.0f,
                };
                additionalInformation.Add(views);

                if (r.Next(0, 10) % 2 == 0)
                {
                    TextLabel quick = new TextLabel()
                    {
                        Text      = "퀵배송",
                        PixelSize = 16.0f,
                        TextColor = new Color("#6c7080"),
                    };
                    additionalInformation.Add(quick);
                }

                if (r.Next(0, 10) % 2 == 0)
                {
                    TextLabel discount = new TextLabel()
                    {
                        Text      = r.Next(0, 20) + "% 카드할인",
                        PixelSize = 16.0f,
                        TextColor = new Color("#6c7080"),
                    };
                    additionalInformation.Add(discount);
                }

                mainInformation.TouchEvent += (object source, TouchEventArgs args) =>
                {
                    bool result = false;
                    if (args.Touch.GetState(0) == PointStateType.Finished)
                    {
                        PageController.Instance.Go("ItemDetail", data);
                        result = true;
                    }

                    return(result);
                };

                View header = new View()
                {
                    Size            = new Size(NUIApplication.GetDefaultWindow().Size.Width, 80),
                    BackgroundColor = new Color("#ffd040"),
                    Layout          = new LinearLayout()
                    {
                        LinearOrientation = LinearLayout.Orientation.Horizontal,
                        LinearAlignment   = LinearLayout.Alignment.CenterVertical,
                        CellPadding       = new Tizen.NUI.Vector2(15, 0),
                    },
                    Padding = new Extents(15, 15, 0, 0),
                };
                Add(header);

                TextLabel logo = new TextLabel()
                {
                    Text      = "Y-MART",
                    PixelSize = 24,
                };
                header.Add(logo);
            }

            BackKeyPressed += (object source, EventArgs args) =>
            {
                NUIApplication.Current.Exit();
            };
        }
Esempio n. 20
0
        View CreateListPage(IEnumerable <TestCaseBase> tests)
        {
            var layout = new View
            {
                HeightResizePolicy = ResizePolicyType.FillToParent,
                WidthResizePolicy  = ResizePolicyType.FillToParent,
                Layout             = new LinearLayout
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                }
            };

            EventHandler <ClickedEventArgs> clicked = (object sender, ClickedEventArgs args) =>
            {
                var testCase = ((sender as View).BindingContext as TestCaseBase);
                RunTC(testCase);
            };


            var collectionview = new ScrollableBase
            {
                Layout = new LinearLayout
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical
                }
            };

            foreach (var item in tests)
            {
                var itemView = new DefaultLinearItem();

                itemView.Focusable      = true;
                itemView.BindingContext = item;
                itemView.Clicked       += clicked;

                var label = new TextLabel
                {
                    VerticalAlignment   = VerticalAlignment.Center,
                    WidthSpecification  = LayoutParamPolicies.MatchParent,
                    HeightSpecification = LayoutParamPolicies.MatchParent,
                };

                label.PixelSize = 30;
                label.SetBinding(TextLabel.TextProperty, new Binding("TestName"));

                itemView.Add(label);
                collectionview.Add(itemView);
            }

            // NUI bug - on target NUI CollectionView was crashed

            /*
             * var collectionview = new CollectionView
             * {
             *  SelectionMode = ItemSelectionMode.None,
             *  WidthResizePolicy = ResizePolicyType.FillToParent,
             *  HeightResizePolicy = ResizePolicyType.FillToParent,
             *  ItemsLayouter = new LinearLayouter(),
             *  ScrollingDirection = ScrollableBase.Direction.Vertical,
             *  ItemsSource = tests,
             *  ItemTemplate = new DataTemplate(() =>
             *  {
             *      //var itemView = new RecyclerViewItem
             *      //{
             *      //    Layout = new LinearLayout
             *      //    {
             *      //        LinearOrientation = LinearLayout.Orientation.Vertical,
             *      //        LinearAlignment = LinearLayout.Alignment.Center
             *      //    },
             *      //    WidthResizePolicy = ResizePolicyType.FillToParent,
             *      //    SizeHeight = 100,
             *      //};
             *      //var border = new BorderVisual
             *      //{
             *      //    Opacity = 0.8f,
             *      //    CornerRadius = 0,
             *      //    BorderSize = 1,
             *      //    Color = Color.Black,
             *      //    AntiAliasing = true,
             *      //};
             *      //itemView.AddVisual("border", border);
             *
             *      var itemView = new DefaultLinearItem();
             *
             *      itemView.Clicked += clicked;
             *
             *      var label = new TextLabel
             *      {
             *          VerticalAlignment = VerticalAlignment.Center,
             *          WidthSpecification = LayoutParamPolicies.MatchParent,
             *          HeightSpecification = LayoutParamPolicies.MatchParent,
             *      };
             *
             *      label.PixelSize = 30;
             *      label.SetBinding(TextLabel.TextProperty, new Binding("TestName"));
             *      itemView.Add(label);
             *      return itemView;
             *      //var itemView = new DefaultLinearItem
             *      //{
             *      //    WidthResizePolicy = ResizePolicyType.FillToParent,
             *      //};
             *
             *      //itemView.Clicked += clicked;
             *      //itemView.Label.PixelSize = 30;
             *      //itemView.Label.SetBinding(TextLabel.TextProperty, new Binding("TestName"));
             *      //return itemView;
             *  })
             * };
             */

            layout.Add(collectionview);

            return(layout);
        }
Esempio n. 21
0
        private void initialize()
        {
            popupStyle = Style as PopupStyle;
            if (popupStyle == null)
            {
                throw new Exception("Popup style is null.");
            }

            BackgroundColor        = Color.Black;
            Size                   = new Size(POPUP_WIDTH, POPUP_HEIGHT);
            PositionUsesPivotPoint = true;
            ParentOrigin           = NUI.ParentOrigin.Center;
            PivotPoint             = NUI.PivotPoint.Center;
            Layout                 = new AbsoluteLayout();

            layer = new Layer()
            {
                Name = "PopupLayer",
            };
            layer.Add(this);

            buttonList = new Dictionary <string, Button>();

            buttonContainer = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
            };
            Add(buttonContainer);

            titleContentContainer = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
            };
            Add(titleContentContainer);

            //will be fixed later.
            //titleContentContainer.Layout = new LinearLayout()
            //{
            //    LinearOrientation = LinearLayout.Orientation.Vertical,
            //    LinearAlignment = LinearLayout.Alignment.Top,
            //};

            title = new TextLabel()
            {
                Name                = "Title",
                Size                = new Size(TITLE_WIDTH, TITLE_HEIGHT),
                PointSize           = TEXT_POINT_SIZE,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                TextColor           = Color.Cyan,

                //will be removed later.
                PositionUsesPivotPoint = true,
                ParentOrigin           = Tizen.NUI.ParentOrigin.TopCenter,
                PivotPoint             = Tizen.NUI.PivotPoint.TopCenter,
                Position = new Position(0, TITLE_POSITION_Y),
            };
            titleContentContainer.Add(title);

            LinearLayout scrollLayout = new LinearLayout();

            scrollLayout.LinearOrientation = LinearLayout.Orientation.Vertical;

            ContentContainer = new View()
            {
                Layout = scrollLayout,

                //will be removed later.
                PositionUsesPivotPoint = true,
                ParentOrigin           = Tizen.NUI.ParentOrigin.TopCenter,
                PivotPoint             = Tizen.NUI.PivotPoint.TopCenter,
            };

            scroll = new ScrollableBase()
            {
                Name = "Scroll",
                PositionUsesPivotPoint = true,
                ScrollingDirection     = ScrollableBase.Direction.Vertical,
                ScrollEnabled          = true,
                WidthResizePolicy      = ResizePolicyType.FillToParent,
                HeightResizePolicy     = ResizePolicyType.FillToParent,

                //will be removed later.
                ParentOrigin = Tizen.NUI.ParentOrigin.TopCenter,
                PivotPoint   = Tizen.NUI.PivotPoint.TopCenter,
                Position     = new Position(0, CONTENT_POSITION_Y),
            };
            titleContentContainer.Add(scroll);
            scroll.Add(ContentContainer);

            scrollList = new Dictionary <string, View>();

            TouchEvent += Popup_TouchEvent;

            title.PropertyChanged += Title_PropertyChanged;
        }
Esempio n. 22
0
        public void Activate()
        {
            Random rnd    = new Random();
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                BackgroundColor     = Color.White,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                Layout = new LinearLayout()
                {
                    LinearOrientation   = LinearLayout.Orientation.Vertical,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    CellPadding         = new Size(10, 10),
                },
            };
            window.Add(root);

            FocusManager.Instance.EnableDefaultAlgorithm(true);

            var top = new Button()
            {
                Focusable        = true,
                FocusableInTouch = true,
                Text             = "Top"
            };

            root.Add(top);

            var verticalScrollView = new ScrollableBase()
            {
                ScrollingDirection  = ScrollableBase.Direction.Vertical,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Gray,
                Layout = new LinearLayout
                {
                    LinearOrientation   = LinearLayout.Orientation.Vertical,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    CellPadding         = new Size2D(10, 10),
                }
            };

            root.Add(verticalScrollView);

            for (int i = 0; i < SCROLLMAX; i++)
            {
                var colorItem = new View()
                {
                    WidthSpecification  = LayoutParamPolicies.MatchParent,
                    HeightSpecification = LayoutParamPolicies.WrapContent,
                    BackgroundColor     = new Color((float)rnd.Next(256) / 256f, (float)rnd.Next(256) / 256f, (float)rnd.Next(256) / 256f, 1),
                    Focusable           = true,
                    FocusableInTouch    = true,
                    Layout = new LinearLayout
                    {
                        LinearOrientation = LinearLayout.Orientation.Horizontal,
                        VerticalAlignment = VerticalAlignment.Center,
                        CellPadding       = new Size2D(10, 10),
                    }
                };
                var label = new TextLabel()
                {
                    Text      = $"[{i}]",
                    PointSize = 20,
                };
                colorItem.Add(label);
                verticalScrollView.Add(colorItem);
            }

            var middle = new Button()
            {
                Focusable        = true,
                FocusableInTouch = true,
                Text             = "Middle"
            };

            root.Add(middle);

            var horizontalLayout = new View()
            {
                BackgroundColor     = Color.White,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    VerticalAlignment = VerticalAlignment.Center,
                    CellPadding       = new Size(10, 10),
                },
            };

            root.Add(horizontalLayout);

            var leftIcon = new RadioButton()
            {
                WidthSpecification  = 50,
                HeightSpecification = 50,
                Focusable           = true,
                FocusableInTouch    = true,
            };

            horizontalLayout.Add(leftIcon);

            var horizontalScrollView = new ScrollableBase()
            {
                ScrollingDirection  = ScrollableBase.Direction.Horizontal,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Gray,
                Layout = new LinearLayout
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    VerticalAlignment = VerticalAlignment.Center,
                    CellPadding       = new Size2D(10, 10),
                }
            };

            horizontalLayout.Add(horizontalScrollView);

            for (int i = 0; i < SCROLLMAX; i++)
            {
                var colorItem = new View()
                {
                    WidthSpecification  = LayoutParamPolicies.WrapContent,
                    HeightSpecification = LayoutParamPolicies.MatchParent,
                    BackgroundColor     = new Color((float)rnd.Next(256) / 256f, (float)rnd.Next(256) / 256f, (float)rnd.Next(256) / 256f, 1),
                    Focusable           = true,
                    FocusableInTouch    = true,
                    Layout = new LinearLayout
                    {
                        LinearOrientation   = LinearLayout.Orientation.Vertical,
                        HorizontalAlignment = HorizontalAlignment.Center,
                        CellPadding         = new Size2D(10, 10),
                    }
                };
                var label = new TextLabel()
                {
                    Text      = $"[{i}]",
                    PointSize = 20,
                };
                colorItem.Add(label);
                horizontalScrollView.Add(colorItem);
            }

            var rightIcon = new RadioButton()
            {
                WidthSpecification  = 50,
                HeightSpecification = 50,
                Focusable           = true,
                FocusableInTouch    = true,
            };

            horizontalLayout.Add(rightIcon);

            var bottom = new Button()
            {
                Focusable        = true,
                FocusableInTouch = true,
                Text             = "Bottom"
            };

            root.Add(bottom);
        }
Esempio n. 23
0
        /// Modify this method for adding other examples.
        public DefaultTitleItemExample() : base()
        {
            Log.Info(this.GetType().Name, $"{this.GetType().Name} is contructed\n");

            WidthSpecification  = LayoutParamPolicies.MatchParent;
            HeightSpecification = LayoutParamPolicies.MatchParent;
            // Navigator bar title is added here.
            AppBar = new AppBar()
            {
                Title = "DefaultTitleItemExample Style",
            };

            // Example root content view.
            // you can decorate, add children on this view.
            var rootContent = new ScrollableBase()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                ScrollingDirection  = ScrollableBase.Direction.Vertical,
                HideScrollbar       = false,
                Layout = new LinearLayout()
                {
                    LinearOrientation   = LinearLayout.Orientation.Vertical,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    CellPadding         = new Size2D(10, 20),
                },
            };

            var item = new DefaultTitleItem()
            {
                WidthSpecification = LayoutParamPolicies.MatchParent,
                Text = "Title Item",
            };

            rootContent.Add(item);

            var path = Tizen.Applications.Application.Current.DirectoryInfo.Resource;

            var arrowStyle = new ButtonStyle()
            {
                IsSelectable            = true,
                Size                    = new Size(40, 40),
                ItemHorizontalAlignment = HorizontalAlignment.Center,
                ItemVerticalAlignment   = VerticalAlignment.Center,
                Icon                    = new ImageViewStyle()
                {
                    ResourceUrl = new Selector <string>()
                    {
                        Normal   = path + "/icon/icon_arrow_down.svg",
                        Pressed  = path + "/icon/icon_arrow_up.svg",
                        Selected = path + "/icon/icon_arrow_up.svg",
                    }
                }
            };

            var itemWithArrow = new DefaultTitleItem()
            {
                WidthSpecification = LayoutParamPolicies.MatchParent,
                Text = "Title Item With Arrow",
                EnableControlStatePropagation = true,
                Icon = new Button(arrowStyle)
                {
                    EnableControlStatePropagation = true,
                },
                IsSelectable = true,
            };

            rootContent.Add(itemWithArrow);

            Content = rootContent;
        }
Esempio n. 24
0
        public View CreatePagination()
        {
            View view = new View()
            {
                Size = new Size(360, 360),
                PositionUsesPivotPoint = true,
                ParentOrigin           = ParentOrigin.Center,
                PivotPoint             = PivotPoint.Center,
            };

            pagination = new CircularPagination()
            {
                Size     = new Size(360, 360),
                Position = new Position(0, 100),

                // Set Pagination properties, such as Indicator size, count, and images.
                IndicatorSize     = new Size(10, 10),
                IndicatorImageURL = new Selector <string>()
                {
                    Normal   = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "normal_dot.png",
                    Selected = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "focus_dot.png",
                },
                //IndicatorSpacing = 8,
                IndicatorCount = PAGE_COUNT,
                SelectedIndex  = 0,

                // Positioning it to the top center
                ParentOrigin           = ParentOrigin.TopCenter,
                PivotPoint             = PivotPoint.TopCenter,
                PositionUsesPivotPoint = true
            };


            // To move on to the next page using Swipe gesture, add ScrollableBase and its View container.
            scrollable = new ScrollableBase()
            {
                Size               = new Size(120, 120),
                Position           = new Position(0, 10),
                ScrollingDirection = ScrollableBase.Direction.Horizontal,
                SnapToPage         = true,

                ParentOrigin           = ParentOrigin.Center,
                PivotPoint             = PivotPoint.Center,
                PositionUsesPivotPoint = true
            };

            View container = new View()
            {
                WidthSpecification  = LayoutParamPolicies.WrapContent,
                HeightSpecification = 120,
                Layout = new LinearLayout()
                {
                    LinearOrientation   = LinearLayout.Orientation.Horizontal,
                    SetPositionByLayout = false,
                },
                //BackgroundColor = Color.Black,
            };

            scrollable.Add(container);

            Tizen.Log.Error("MYLOG", "add scroll");
            for (int i = 0; i < PAGE_COUNT; i++)
            {
                View page = new View()
                {
                    Size            = new Size(120, 120),
                    CornerRadius    = 60.0f,
                    BackgroundColor = (i % 2 == 0)?Color.Yellow:Color.Red,
                };

                container.Add(page);
            }
            view.Add(scrollable);
            view.Add(pagination);

            // Screen Touch Event
            scrollable.ScrollAnimationEnded += Scrollable_ScrollAnimationEnded;
            return(view);
        }
Esempio n. 25
0
        public void Activate()
        {
            window = NUIApplication.GetDefaultWindow();

            rootView = new ScrollableBase()
            {
                ScrollingDirection  = ScrollableBase.Direction.Vertical,
                HideScrollbar       = false,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.White,
            };
            window.Add(rootView);

            var mainView = new View()
            {
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                    CellPadding       = new Size2D(0, 20),
                },
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.Black,
            };

            rootView.Add(mainView);

            var flexRowViewTitle = new TextLabel()
            {
                Text = "Row with MatchParent",
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.White,
            };

            mainView.Add(flexRowViewTitle);

            var flexRowView = new View()
            {
                Layout = new FlexLayout()
                {
                    Direction = FlexLayout.FlexDirection.Row,
                },
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = 400,
                Margin          = new Extents(20, 20, 20, 20),
                Padding         = new Extents(20, 20, 20, 20),
                BackgroundColor = Color.White,
            };

            mainView.Add(flexRowView);

            var rowChild = new View()
            {
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                },
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Black,
            };

            flexRowView.Add(rowChild);

            var rowGrandChild = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Red,
            };

            rowChild.Add(rowGrandChild);

            var rowGrandChild2 = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Green,
            };

            rowChild.Add(rowGrandChild2);

            var rowChild2 = new View()
            {
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                },
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Black,
            };

            flexRowView.Add(rowChild2);

            var rowGrandChild3 = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Blue,
            };

            rowChild2.Add(rowGrandChild3);

            var rowGrandChild4 = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Yellow,
            };

            rowChild2.Add(rowGrandChild4);

            var flexColViewTitle = new TextLabel()
            {
                Text = "Column with MatchParent",
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.White,
            };

            mainView.Add(flexColViewTitle);

            var flexColView = new View()
            {
                Layout = new FlexLayout()
                {
                    Direction = FlexLayout.FlexDirection.Column,
                },
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = 400,
                Margin          = new Extents(20, 20, 20, 20),
                Padding         = new Extents(20, 20, 20, 20),
                BackgroundColor = Color.White,
            };

            mainView.Add(flexColView);

            var colChild = new View()
            {
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                },
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Black,
            };

            flexColView.Add(colChild);

            var colGrandChild = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Red,
            };

            colChild.Add(colGrandChild);

            var colGrandChild2 = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Green,
            };

            colChild.Add(colGrandChild2);

            var colChild2 = new View()
            {
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                },
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Black,
            };

            flexColView.Add(colChild2);

            var colGrandChild3 = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Blue,
            };

            colChild2.Add(colGrandChild3);

            var colGrandChild4 = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Yellow,
            };

            colChild2.Add(colGrandChild4);
        }
Esempio n. 26
0
    void Initialize()
    {
        window = NUIApplication.GetDefaultWindow();
        window.BackgroundColor = new Color(0.678f, 0.655f, 0.576f, 1.0f);

        View topView = new View()
        {
            HeightSpecification = LayoutParamPolicies.WrapContent,
            WidthSpecification  = LayoutParamPolicies.MatchParent,
        };

        ImageView lowerImageView = CreateLowerImageView();

        lowerImageView.Size     = new Size(120, 120);
        lowerImageView.Position = new Position(40, 40);
        topView.Add(lowerImageView);

        TextLabel lowerImageName = new TextLabel()
        {
            HorizontalAlignment = HorizontalAlignment.Center,
            VerticalAlignment   = VerticalAlignment.Center,
            PointSize           = 12,
            Size      = new Size(120, 30),
            Position  = new Position(40, 160),
            TextColor = new Color(0.2f, 0.2f, 0.2f, 1.0f),
            Text      = "Lower Image",
        };

        topView.Add(lowerImageName);

        // BlendEquationType.Min to show original image in this background color
        View upperColorView = CreateUpperColorView(new Size(120, 120), BlendEquationType.Min);

        upperColorView.Position = new Position(window.Size.Width - 160, 40);
        topView.Add(upperColorView);

        TextLabel upperColorHeading = new TextLabel()
        {
            HorizontalAlignment = HorizontalAlignment.Center,
            VerticalAlignment   = VerticalAlignment.Center,
            PointSize           = 12,
            Size      = new Size(120, 30),
            Position  = new Position(window.Size.Width - 160, 160),
            TextColor = new Color(0.2f, 0.2f, 0.2f, 1.0f),
            Text      = "Upper Image",
        };

        topView.Add(upperColorHeading);

        window.Add(topView);

        contents = new ScrollableBase()
        {
            Position            = new Position(0, 200),
            HeightSpecification = window.Size.Height - 220,
            WidthSpecification  = LayoutParamPolicies.MatchParent,
            ScrollingDirection  = ScrollableBase.Direction.Vertical,

            Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Vertical,
                CellPadding       = new Size2D(0, 20)
            },
            Padding = new Extents(20),
        };
        window.Add(contents);

        for (int i = 0; i < advansedBlendEquationCount; ++i)
        {
            AddBlendEquationItem(blendEquationTypes[i]);
        }
    }
Esempio n. 27
0
    protected override void OnCreate()
    {
        base.OnCreate();

        Window window = NUIApplication.GetDefaultWindow();

        window.BackgroundColor = Color.Black;

        // Create Pagination component
        pagination = new Pagination()
        {
            Size     = new Size(118, 10),
            Position = new Position(0, 24),

            // Set Pagination properties, such as Indicator size, count, and images.
            IndicatorSize    = new Size(10, 10),
            IndicatorSpacing = 8,
            IndicatorCount   = PAGE_COUNT,
            SelectedIndex    = 0,

            // Positioning it to the top center
            ParentOrigin           = ParentOrigin.TopCenter,
            PivotPoint             = PivotPoint.TopCenter,
            PositionUsesPivotPoint = true
        };


        // To move on to the next page using Swipe gesture, add ScrollableBase and its View container.
        scrollable = new ScrollableBase()
        {
            Size = new Size(360, 360),

            ScrollingDirection = ScrollableBase.Direction.Horizontal,
            SnapToPage         = true,

            ParentOrigin           = ParentOrigin.Center,
            PivotPoint             = PivotPoint.Center,
            PositionUsesPivotPoint = true
        };

        View container = new View()
        {
            WidthSpecification  = LayoutParamPolicies.WrapContent,
            HeightSpecification = 360,
            Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Horizontal,
            },
            BackgroundColor = Color.Black,
        };

        scrollable.Add(container);

        for (int i = 0; i < PAGE_COUNT; i++)
        {
            View page = new View()
            {
                Size            = new Size(360, 360),
                CornerRadius    = 150.0f,
                BackgroundColor = Color.Black,
            };

            container.Add(page);
        }

        window.Add(scrollable);
        window.Add(pagination);

        // Bezel event
        window.WheelEvent += Pagination_WheelEvent;

        // Screen Touch Event
        scrollable.ScrollAnimationEnded += Scroll_AnimationEnded;
    }
Esempio n. 28
0
        public ItemDetailPage(ItemData data) : base(data)
        {
            ScrollableBase infoScroll = new ScrollableBase()
            {
                ScrollingDirection = ScrollableBase.Direction.Vertical,
                Size   = new Size(Size),
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                },
            };

            Add(infoScroll);

            View information = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.WrapContent,
                Margin  = new Extents(0, 0, (ushort)NUIApplication.GetDefaultWindow().Size.Width, 0),
                Padding = new Extents(PADDING, PADDING, 0, 0),
                Layout  = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                }
            };

            infoScroll.Add(information);

            TextLabel itemName = new TextLabel()
            {
                Text = data.Name,
                WidthSpecification = LayoutParamPolicies.MatchParent,
                PixelSize          = 24.0f,
                Margin             = new Extents(0, 0, PADDING, 0),
                MultiLine          = true,
            };

            information.Add(itemName);

            TextLabel origin = new TextLabel()
            {
                Text = "원산지 : " + data.Origin,
                WidthSpecification = LayoutParamPolicies.MatchParent,
                PixelSize          = 16.0f,
                Margin             = new Extents(0, 0, PADDING, 0),
                TextColor          = new Color("#777777"),
            };

            information.Add(origin);

            TextLabel price = new TextLabel()
            {
                Text = data.Price,
                WidthSpecification = LayoutParamPolicies.MatchParent,
                PixelSize          = 24.0f,
                Margin             = new Extents(0, 0, PADDING, 0),
            };

            information.Add(price);

            View line = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = 1,
                Margin          = new Extents(0, 0, PADDING, PADDING),
                BackgroundColor = new Color("#f0f0f0")
            };

            information.Add(line);

            TextLabel detailHeader = new TextLabel()
            {
                Text = "상품에 대한 자세한 정보",
                WidthSpecification = LayoutParamPolicies.MatchParent,
                PixelSize          = 24.0f,
                Margin             = new Extents(0, 0, 0, PADDING),
            };

            information.Add(detailHeader);

            View fakeDetails = new View()
            {
                WidthSpecification  = 480,
                HeightSpecification = 4000,
                BackgroundColor     = Color.White,
            };

            information.Add(fakeDetails);

            View header = new View()
            {
                Size            = new Size(NUIApplication.GetDefaultWindow().Size.Width, 80),
                BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.9f),
                Layout          = new AbsoluteLayout()
                {
                    SetPositionByLayout = false,
                }
            };

            Add(header);

            ImageView itemImage = new ImageView()
            {
                ResourceUrl            = "./res/images/" + data.ImageUrl,
                Size                   = new Size(NUIApplication.GetDefaultWindow().Size.Width, NUIApplication.GetDefaultWindow().Size.Width),
                DesiredWidth           = NUIApplication.GetDefaultWindow().Size.Width,
                DesiredHeight          = NUIApplication.GetDefaultWindow().Size.Width,
                PositionUsesPivotPoint = true,
                PivotPoint             = Tizen.NUI.PivotPoint.TopCenter,
                ParentOrigin           = Tizen.NUI.ParentOrigin.TopCenter,
                Layout                 = new AbsoluteLayout()
                {
                    SetPositionByLayout = false,
                }
            };

            header.Add(itemImage);

            ImageView backButton = new ImageView()
            {
                Size     = new Size(BACK_BUTTON_IMAGE_SIZE, BACK_BUTTON_IMAGE_SIZE),
                Color    = Color.Black,
                Position = new Position(PADDING, 0),
                PositionUsesPivotPoint = true,
                PivotPoint             = Tizen.NUI.PivotPoint.CenterLeft,
                ParentOrigin           = Tizen.NUI.ParentOrigin.CenterLeft,
                ResourceUrl            = "./res/images/back.png",
            };

            header.Add(backButton);
            backButton.TouchEvent += (object source, TouchEventArgs args) =>
            {
                if (args.Touch.GetState(0) == PointStateType.Finished || args.Touch.GetState(0) == PointStateType.Up)
                {
                    PageController.Instance.GoBack();
                    return(true);
                }
                else
                {
                    return(false);
                }
            };

            TextLabel headerItemName = new TextLabel()
            {
                Text              = data.Name,
                Size              = new Size(NUIApplication.GetDefaultWindow().Size.Width - (PADDING * 2 + backButton.Size.Width) - (PADDING * 2 + ITEM_IMAGE_SMALL_SIZE), header.Size.Height),
                PixelSize         = 18.0f,
                VerticalAlignment = VerticalAlignment.Center,
                Position          = new Position(PADDING * 2 + backButton.Size.Width, 0),
                Opacity           = 0.0f,
            };

            header.Add(headerItemName);

            iconSlideAnimation = new Animation(200);
            iconSlideAnimation.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut);

            infoScroll.Scrolling += (object source, ScrollEventArgs args) =>
            {
                float scrollPosition = Math.Abs(args.Position.Y);
                if (scrollPosition <= NUIApplication.GetDefaultWindow().Size.Width - header.Size.Height)
                {
                    float process      = scrollPosition / (NUIApplication.GetDefaultWindow().Size.Width - header.Size.Height);
                    float targetRadius = ITEM_IMAGE_SMALL_SIZE / 2.0f * process;
                    targetRadius = targetRadius < 1f ? 1f : targetRadius;
                    float targetSize     = -(NUIApplication.GetDefaultWindow().Size.Width - ITEM_IMAGE_SMALL_SIZE) * process + NUIApplication.GetDefaultWindow().Size.Width;
                    float targetPosition = PADDING * process;

                    itemImage.CornerRadius          = targetRadius;
                    itemImage.Size                  = new Size(targetSize, targetSize);
                    itemImage.PositionY             = targetPosition;
                    headerItemName.Opacity          = 0.0f;
                    headerItemName.EnableAutoScroll = false;

                    if (itemImage.CurrentPosition.X == (NUIApplication.GetDefaultWindow().Size.Width / 2.0f - (PADDING + ITEM_IMAGE_SMALL_SIZE / 2.0f)))
                    {
                        header.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.9f);
                        iconSlideAnimation.Reset();
                        iconSlideAnimation.AnimateTo(itemImage, "positionX", 0.0f);
                        iconSlideAnimation.Play();
                    }
                }
                else if (scrollPosition <= NUIApplication.GetDefaultWindow().Size.Width + header.Size.Height)
                {
                    float process                     = (scrollPosition - NUIApplication.GetDefaultWindow().Size.Width + header.Size.Height) / (header.Size.Height * 2.0f);
                    float targetPosition              = (NUIApplication.GetDefaultWindow().Size.Width / 2.0f - (PADDING + ITEM_IMAGE_SMALL_SIZE / 2.0f)) * process;
                    float targetButtonColor           = -process + 1.0f;
                    float targetHeaderBackgroundColor = process > 0.8f ? 0.8f : process;

                    itemImage.CornerRadius          = ITEM_IMAGE_SMALL_SIZE / 2.0f;
                    itemImage.Size                  = new Size(ITEM_IMAGE_SMALL_SIZE, ITEM_IMAGE_SMALL_SIZE);
                    itemImage.PositionY             = PADDING;
                    headerItemName.Opacity          = process;
                    headerItemName.EnableAutoScroll = true;

                    if (itemImage.CurrentPosition.X == 0.0f)
                    {
                        header.BackgroundColor = new Color("#ffd040");
                        iconSlideAnimation.Reset();
                        iconSlideAnimation.AnimateTo(itemImage, "positionX", (NUIApplication.GetDefaultWindow().Size.Width / 2.0f - (PADDING + ITEM_IMAGE_SMALL_SIZE / 2.0f)));
                        iconSlideAnimation.Play();
                    }
                }
                else
                {
                    itemImage.CornerRadius = ITEM_IMAGE_SMALL_SIZE / 2.0f;
                    itemImage.Size         = new Size(ITEM_IMAGE_SMALL_SIZE, ITEM_IMAGE_SMALL_SIZE);
                    headerItemName.Opacity = 1.0f;
                }
            };

            BackKeyPressed += (object source, EventArgs args) =>
            {
                PageController.Instance.GoBack();
            };
        }
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root        = new View();
            root.Layout = new AbsoluteLayout();
            root.Size   = new Size(500, 800);

            root.BackgroundColor = Color.White;
            window.Add(root);

            FocusManager.Instance.EnableDefaultAlgorithm(true);
            root.Layout = new LinearLayout
            {
                LinearOrientation = LinearLayout.Orientation.Vertical
            };
            root.WidthSpecification  = LayoutParamPolicies.MatchParent;
            root.HeightSpecification = LayoutParamPolicies.MatchParent;


            var topbtn = new Button
            {
                Focusable        = true,
                FocusableInTouch = true,
                Text             = "Top"
            };

            root.Add(topbtn);

            var scrollview = new ScrollableBase
            {
                ScrollingDirection  = ScrollableBase.Direction.Vertical,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Gray
            };

            scrollview.ContentContainer.Layout             = new AbsoluteLayout();
            scrollview.ContentContainer.WidthSpecification = LayoutParamPolicies.MatchParent;
            scrollview.ContentContainer.SizeHeight         = 1800;
            root.Add(scrollview);
            for (int i = 0; i < 40; i++)
            {
                scrollview.ContentContainer.Add(CreateButton(i));
            }

            var middle = new Button
            {
                Focusable        = true,
                FocusableInTouch = true,
                Text             = "Middle"
            };

            root.Add(middle);

            var myscrollview = new ScrollableBase
            {
                ScrollingDirection  = ScrollableBase.Direction.Vertical,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.Yellow
            };

            myscrollview.ContentContainer.Layout             = new AbsoluteLayout();
            myscrollview.ContentContainer.WidthSpecification = LayoutParamPolicies.MatchParent;
            myscrollview.ContentContainer.SizeHeight         = 1800;
            root.Add(myscrollview);
            for (int i = 0; i < 40; i++)
            {
                myscrollview.ContentContainer.Add(CreateButton(i));
            }

            var bottom = new Button
            {
                Focusable        = true,
                FocusableInTouch = true,
                Text             = "bottom"
            };

            root.Add(bottom);
        }
Esempio n. 30
0
        public void Activate()
        {
            window = NUIApplication.GetDefaultWindow();

            rootView = new ScrollableBase()
            {
                ScrollingDirection  = ScrollableBase.Direction.Vertical,
                HideScrollbar       = false,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = Color.White,
            };
            window.Add(rootView);

            var mainView = new View()
            {
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                    CellPadding       = new Size2D(0, 20),
                },
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.White,
            };

            rootView.Add(mainView);

            var absoluteViewTitle = new TextLabel()
            {
                Text = "AbsoluteLayout",
                WidthSpecification = LayoutParamPolicies.MatchParent,
            };

            mainView.Add(absoluteViewTitle);

            var absoluteView = new View()
            {
                Layout              = new AbsoluteLayout(),
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = 150,
                BackgroundColor     = Color.White,
            };

            mainView.Add(absoluteView);

            var absoluteTopText = new TextField()
            {
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.Red,
            };

            absoluteTopText.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"AbsoluteLayout Top Text has been changed to \"{args.TextField.Text}\".");
            };
            absoluteView.Add(absoluteTopText);

            var absoluteCenterText = new TextField()
            {
                Text                   = "Center",
                BackgroundColor        = Color.Blue,
                ParentOrigin           = new Position(0.5f, 0.5f, 0.5f),
                PivotPoint             = new Position(0.5f, 0.5f, 0.5f),
                PositionUsesPivotPoint = true,
            };

            absoluteCenterText.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"AbsoluteLayout Center Text has been changed to \"{args.TextField.Text}\".");
            };
            absoluteView.Add(absoluteCenterText);

            var absoluteBottomText = new TextField()
            {
                Text                   = "Bottom",
                BackgroundColor        = Color.Green,
                ParentOrigin           = new Position(0.5f, 1.0f, 0.5f),
                PivotPoint             = new Position(0.5f, 1.0f, 0.5f),
                PositionUsesPivotPoint = true,
            };

            absoluteBottomText.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"AbsoluteLayout Bottom Text has been changed to \"{args.TextField.Text}\".");
            };
            absoluteView.Add(absoluteBottomText);

            var linearViewTitle = new TextLabel()
            {
                Text = "LinearLayout",
                WidthSpecification = LayoutParamPolicies.MatchParent,
            };

            mainView.Add(linearViewTitle);

            var linearView = new View()
            {
                Layout = new LinearLayout()
                {
                    CellPadding = new Size2D(10, 0),
                },
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.White,
            };

            mainView.Add(linearView);

            var linearLeft = new View()
            {
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                    CellPadding       = new Size2D(0, 10),
                },
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.White,
            };

            linearView.Add(linearLeft);

            var linearLeftText1 = new TextField()
            {
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.Red,
            };

            linearLeftText1.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"LinearLayout Left default size Text has been changed to \"{args.TextField.Text}\".");
            };
            linearLeft.Add(linearLeftText1);

            var linearLeftText2 = new TextField()
            {
                PixelSize          = 16,
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.Red,
            };

            linearLeftText2.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"LinearLayout Left PixelSize 16 Text has been changed to \"{args.TextField.Text}\".");
            };
            linearLeft.Add(linearLeftText2);

            var linearLeftText3 = new TextField()
            {
                PixelSize          = 64,
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.Red,
            };

            linearLeftText3.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"LinearLayout Left PixelSize 64 Text has been changed to \"{args.TextField.Text}\".");
            };
            linearLeft.Add(linearLeftText3);

            var linearLeftText4 = new TextField()
            {
                BackgroundColor = Color.Red,
            };

            linearLeftText4.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"LinearLayout Left Text with WrapContent WidthSpecification has been changed to \"{args.TextField.Text}\".");
            };
            linearLeft.Add(linearLeftText4);

            var linearRight = new View()
            {
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                    CellPadding       = new Size2D(0, 10),
                },
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.White,
            };

            linearView.Add(linearRight);

            var linearRightText1 = new TextField()
            {
                Text = "Default",
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.Red,
            };

            linearRightText1.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"LinearLayout Right default size Text has been changed to \"{args.TextField.Text}\".");
            };
            linearRight.Add(linearRightText1);

            var linearRightText2 = new TextField()
            {
                Text               = "16",
                PixelSize          = 16,
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.Red,
            };

            linearRightText2.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"LinearLayout Right PixelSize 16 Text has been changed to \"{args.TextField.Text}\".");
            };
            linearRight.Add(linearRightText2);

            var linearRightText3 = new TextField()
            {
                Text               = "64",
                PixelSize          = 64,
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.Red,
            };

            linearRightText3.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"LinearLayout Right PixelSize 64 Text has been changed to \"{args.TextField.Text}\".");
            };
            linearRight.Add(linearRightText3);

            var linearRightText4 = new TextField()
            {
                Text            = "WrapContent",
                BackgroundColor = Color.Red,
            };

            linearRightText4.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"LinearLayout Right Text with WrapContent WidthSpecification has been changed to \"{args.TextField.Text}\".");
            };
            linearRight.Add(linearRightText4);

            var gridViewTitle = new TextLabel()
            {
                Text = "GridLayout",
                WidthSpecification = LayoutParamPolicies.MatchParent,
            };

            mainView.Add(gridViewTitle);

            var gridView = new View()
            {
                Layout = new GridLayout()
                {
                    Rows          = 5,
                    Columns       = 2,
                    RowSpacing    = 10,
                    ColumnSpacing = 10,
                },
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.White,
            };

            mainView.Add(gridView);

            var gridCol1Text1 = new TextField()
            {
                BackgroundColor = Color.Green,
            };

            gridCol1Text1.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"GridLayout Column 1 default size Text has been changed to \"{args.TextField.Text}\".");
            };
            GridLayout.SetRow(gridCol1Text1, 0);
            GridLayout.SetColumn(gridCol1Text1, 0);
            GridLayout.SetHorizontalStretch(gridCol1Text1, GridLayout.StretchFlags.ExpandAndFill);
            GridLayout.SetVerticalStretch(gridCol1Text1, GridLayout.StretchFlags.ExpandAndFill);
            gridView.Add(gridCol1Text1);

            var gridCol1Text2 = new TextField()
            {
                PixelSize       = 16,
                BackgroundColor = Color.Green,
            };

            gridCol1Text2.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"GridLayout Column 1 PixelSize 16 Text has been changed to \"{args.TextField.Text}\".");
            };
            GridLayout.SetRow(gridCol1Text2, 1);
            GridLayout.SetColumn(gridCol1Text2, 0);
            GridLayout.SetHorizontalStretch(gridCol1Text2, GridLayout.StretchFlags.ExpandAndFill);
            GridLayout.SetVerticalStretch(gridCol1Text2, GridLayout.StretchFlags.ExpandAndFill);
            gridView.Add(gridCol1Text2);

            var gridCol1Text3 = new TextField()
            {
                PixelSize       = 64,
                BackgroundColor = Color.Green,
            };

            gridCol1Text3.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"GridLayout Column 1 PixelSize 64 Text has been changed to \"{args.TextField.Text}\".");
            };
            GridLayout.SetRow(gridCol1Text3, 2);
            GridLayout.SetColumn(gridCol1Text3, 0);
            GridLayout.SetHorizontalStretch(gridCol1Text3, GridLayout.StretchFlags.ExpandAndFill);
            GridLayout.SetVerticalStretch(gridCol1Text3, GridLayout.StretchFlags.ExpandAndFill);
            gridView.Add(gridCol1Text3);

            var gridCol1Text4 = new TextField()
            {
                BackgroundColor = Color.Green,
            };

            gridCol1Text4.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"GridLayout Column 1 Text with Fill has been changed to \"{args.TextField.Text}\".");
            };
            GridLayout.SetRow(gridCol1Text4, 3);
            GridLayout.SetColumn(gridCol1Text4, 0);
            GridLayout.SetHorizontalStretch(gridCol1Text4, GridLayout.StretchFlags.Fill);
            GridLayout.SetVerticalStretch(gridCol1Text4, GridLayout.StretchFlags.Fill);
            gridView.Add(gridCol1Text4);

            var gridCol1Text5 = new TextField()
            {
                BackgroundColor = Color.Green,
            };

            gridCol1Text5.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"GridLayout Column 1 Text with Expand has been changed to \"{args.TextField.Text}\".");
            };
            GridLayout.SetRow(gridCol1Text5, 4);
            GridLayout.SetColumn(gridCol1Text5, 0);
            GridLayout.SetHorizontalStretch(gridCol1Text5, GridLayout.StretchFlags.Expand);
            GridLayout.SetVerticalStretch(gridCol1Text5, GridLayout.StretchFlags.Expand);
            gridView.Add(gridCol1Text5);

            var gridCol2Text1 = new TextField()
            {
                Text            = "Default",
                BackgroundColor = Color.Green,
            };

            gridCol2Text1.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"GridLayout Column 2 default size Text has been changed to \"{args.TextField.Text}\".");
            };
            GridLayout.SetRow(gridCol2Text1, 0);
            GridLayout.SetColumn(gridCol2Text1, 1);
            GridLayout.SetHorizontalStretch(gridCol2Text1, GridLayout.StretchFlags.ExpandAndFill);
            GridLayout.SetVerticalStretch(gridCol2Text1, GridLayout.StretchFlags.ExpandAndFill);
            gridView.Add(gridCol2Text1);

            var gridCol2Text2 = new TextField()
            {
                Text            = "16",
                PixelSize       = 16,
                BackgroundColor = Color.Green,
            };

            gridCol2Text2.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"GridLayout Column 2 PixelSize 16 Text has been changed to \"{args.TextField.Text}\".");
            };
            GridLayout.SetRow(gridCol2Text2, 1);
            GridLayout.SetColumn(gridCol2Text2, 1);
            GridLayout.SetHorizontalStretch(gridCol2Text2, GridLayout.StretchFlags.ExpandAndFill);
            GridLayout.SetVerticalStretch(gridCol2Text2, GridLayout.StretchFlags.ExpandAndFill);
            gridView.Add(gridCol2Text2);

            var gridCol2Text3 = new TextField()
            {
                Text            = "64",
                PixelSize       = 64,
                BackgroundColor = Color.Green,
            };

            gridCol2Text3.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"GridLayout Column 2 PixelSize 64 Text has been changed to \"{args.TextField.Text}\".");
            };
            GridLayout.SetRow(gridCol2Text3, 2);
            GridLayout.SetColumn(gridCol2Text3, 1);
            GridLayout.SetHorizontalStretch(gridCol2Text3, GridLayout.StretchFlags.ExpandAndFill);
            GridLayout.SetVerticalStretch(gridCol2Text3, GridLayout.StretchFlags.ExpandAndFill);
            gridView.Add(gridCol2Text3);

            var gridCol2Text4 = new TextField()
            {
                Text            = "Fill",
                BackgroundColor = Color.Green,
            };

            gridCol2Text4.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"GridLayout Column 2 Text with Fill has been changed to \"{args.TextField.Text}\".");
            };
            GridLayout.SetRow(gridCol2Text4, 3);
            GridLayout.SetColumn(gridCol2Text4, 1);
            GridLayout.SetHorizontalStretch(gridCol2Text4, GridLayout.StretchFlags.Fill);
            GridLayout.SetVerticalStretch(gridCol2Text4, GridLayout.StretchFlags.ExpandAndFill);
            gridView.Add(gridCol2Text4);

            var gridCol2Text5 = new TextField()
            {
                Text            = "Expand",
                BackgroundColor = Color.Green,
            };

            gridCol2Text5.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"GridLayout Column 2 Text with Expand has been changed to \"{args.TextField.Text}\".");
            };
            GridLayout.SetRow(gridCol2Text5, 4);
            GridLayout.SetColumn(gridCol2Text5, 1);
            GridLayout.SetHorizontalStretch(gridCol2Text5, GridLayout.StretchFlags.Expand);
            GridLayout.SetVerticalStretch(gridCol2Text5, GridLayout.StretchFlags.ExpandAndFill);
            gridView.Add(gridCol2Text5);

            var relativeViewTitle = new TextLabel()
            {
                Text = "RelativeLayout",
                WidthSpecification = LayoutParamPolicies.MatchParent,
            };

            mainView.Add(relativeViewTitle);

            var relativeView = new View()
            {
                Layout             = new RelativeLayout(),
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.White,
            };

            mainView.Add(relativeView);

            var relTopText = new TextField()
            {
                Text = "Top with Fill",
                HorizontalAlignment = HorizontalAlignment.Center,
                BackgroundColor     = Color.Red,
            };

            relTopText.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"RelativeLayout Top Text has been changed to \"{args.TextField.Text}\".");
            };
            RelativeLayout.SetTopRelativeOffset(relTopText, 0.0f);
            RelativeLayout.SetBottomRelativeOffset(relTopText, 0.0f);
            RelativeLayout.SetLeftRelativeOffset(relTopText, 0.0f);
            RelativeLayout.SetRightRelativeOffset(relTopText, 1.0f);
            RelativeLayout.SetFillHorizontal(relTopText, true);
            relativeView.Add(relTopText);

            var relLeftText = new TextField()
            {
                Text            = "Left",
                BackgroundColor = Color.Green,
            };

            relLeftText.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"RelativeLayout Left Text has been changed to \"{args.TextField.Text}\".");
            };
            RelativeLayout.SetTopTarget(relLeftText, relTopText);
            RelativeLayout.SetTopRelativeOffset(relLeftText, 1.0f);
            RelativeLayout.SetBottomTarget(relLeftText, relTopText);
            RelativeLayout.SetBottomRelativeOffset(relLeftText, 1.0f);
            RelativeLayout.SetLeftRelativeOffset(relLeftText, 0.0f);
            RelativeLayout.SetRightRelativeOffset(relLeftText, 0.0f);
            relativeView.Add(relLeftText);

            var relRightText = new TextField()
            {
                Text            = "Right",
                BackgroundColor = Color.Blue,
            };

            relRightText.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"RelativeLayout Right Text has been changed to \"{args.TextField.Text}\".");
            };
            RelativeLayout.SetTopTarget(relRightText, relTopText);
            RelativeLayout.SetTopRelativeOffset(relRightText, 1.0f);
            RelativeLayout.SetBottomTarget(relRightText, relTopText);
            RelativeLayout.SetBottomRelativeOffset(relRightText, 1.0f);
            RelativeLayout.SetLeftRelativeOffset(relRightText, 1.0f);
            RelativeLayout.SetRightRelativeOffset(relRightText, 1.0f);
            RelativeLayout.SetHorizontalAlignment(relRightText, RelativeLayout.Alignment.End);
            relativeView.Add(relRightText);

            var relBottomText = new TextField()
            {
                Text            = "Bottom",
                BackgroundColor = Color.Yellow,
            };

            relBottomText.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"RelativeLayout Bottom Text has been changed to \"{args.TextField.Text}\".");
            };
            RelativeLayout.SetTopRelativeOffset(relBottomText, 1.0f);
            RelativeLayout.SetBottomRelativeOffset(relBottomText, 1.0f);
            RelativeLayout.SetLeftTarget(relBottomText, relLeftText);
            RelativeLayout.SetLeftRelativeOffset(relBottomText, 1.0f);
            RelativeLayout.SetRightTarget(relBottomText, relRightText);
            RelativeLayout.SetRightRelativeOffset(relBottomText, 0.0f);
            RelativeLayout.SetHorizontalAlignment(relBottomText, RelativeLayout.Alignment.Center);
            RelativeLayout.SetVerticalAlignment(relBottomText, RelativeLayout.Alignment.End);
            relativeView.Add(relBottomText);

            var relCenterText = new TextField()
            {
                BackgroundColor = Color.Purple,
            };

            relCenterText.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"RelativeLayout Center Text has been changed to \"{args.TextField.Text}\".");
            };
            RelativeLayout.SetTopTarget(relCenterText, relTopText);
            RelativeLayout.SetTopRelativeOffset(relCenterText, 1.0f);
            RelativeLayout.SetBottomTarget(relCenterText, relBottomText);
            RelativeLayout.SetBottomRelativeOffset(relCenterText, 0.0f);
            RelativeLayout.SetLeftTarget(relCenterText, relLeftText);
            RelativeLayout.SetLeftRelativeOffset(relCenterText, 1.0f);
            RelativeLayout.SetRightTarget(relCenterText, relRightText);
            RelativeLayout.SetRightRelativeOffset(relCenterText, 0.0f);
            RelativeLayout.SetFillHorizontal(relCenterText, true);
            relativeView.Add(relCenterText);

            var flexRowViewTitle = new TextLabel()
            {
                Text = "FlexLayout with Row Direction",
                WidthSpecification = LayoutParamPolicies.MatchParent,
            };

            mainView.Add(flexRowViewTitle);

            var flexRowView = new View()
            {
                Layout = new FlexLayout()
                {
                    Direction      = FlexLayout.FlexDirection.Row,
                    WrapType       = FlexLayout.FlexWrapType.Wrap,
                    Alignment      = FlexLayout.AlignmentType.Center,
                    ItemsAlignment = FlexLayout.AlignmentType.Center,
                    Justification  = FlexLayout.FlexJustification.SpaceEvenly,
                },
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.White,
            };

            mainView.Add(flexRowView);

            var flexRowText1 = new TextField()
            {
                Text            = "TextField",
                BackgroundColor = Color.Red,
            };

            flexRowText1.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"FlexLayout with Row First Text has been changed to \"{args.TextField.Text}\".");
            };
            flexRowView.Add(flexRowText1);

            var flexRowText2 = new TextField()
            {
                Text            = "TextField",
                BackgroundColor = Color.Green,
            };

            flexRowText2.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"FlexLayout with Row Second Text has been changed to \"{args.TextField.Text}\".");
            };
            flexRowView.Add(flexRowText2);

            var flexRowText3 = new TextField()
            {
                Text            = "TextField",
                BackgroundColor = Color.Blue,
            };

            flexRowText3.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"FlexLayout with Row Third Text has been changed to \"{args.TextField.Text}\".");
            };
            flexRowView.Add(flexRowText3);

            var flexRowText4 = new TextField()
            {
                Text            = "TextField",
                BackgroundColor = Color.Yellow,
            };

            flexRowText4.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"FlexLayout with Row Fourth Text has been changed to \"{args.TextField.Text}\".");
            };
            flexRowView.Add(flexRowText4);

            var flexColViewTitle = new TextField()
            {
                Text = "FlexLayout with Column Direction",
                WidthSpecification = LayoutParamPolicies.MatchParent,
            };

            mainView.Add(flexColViewTitle);

            var flexColView = new View()
            {
                Layout = new FlexLayout()
                {
                    Direction      = FlexLayout.FlexDirection.Column,
                    WrapType       = FlexLayout.FlexWrapType.Wrap,
                    Alignment      = FlexLayout.AlignmentType.Center,
                    ItemsAlignment = FlexLayout.AlignmentType.Center,
                    Justification  = FlexLayout.FlexJustification.SpaceEvenly,
                },
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = 150,
                BackgroundColor     = Color.White,
            };

            mainView.Add(flexColView);

            var flexColText1 = new TextField()
            {
                Text            = "TextField",
                BackgroundColor = Color.Red,
            };

            flexColText1.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"FlexLayout with Column First Text has been changed to \"{args.TextField.Text}\".");
            };
            flexColView.Add(flexColText1);

            var flexColText2 = new TextField()
            {
                Text            = "TextField",
                BackgroundColor = Color.Green,
            };

            flexColText2.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"FlexLayout with Column Second Text has been changed to \"{args.TextField.Text}\".");
            };
            flexColView.Add(flexColText2);

            var flexColText3 = new TextField()
            {
                Text            = "TextField",
                BackgroundColor = Color.Blue,
            };

            flexColText3.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"FlexLayout with Column Third Text has been changed to \"{args.TextField.Text}\".");
            };
            flexColView.Add(flexColText3);

            var flexColText4 = new TextField()
            {
                Text            = "TextField",
                BackgroundColor = Color.Yellow,
            };

            flexColText4.TextChanged += (object sender, TextField.TextChangedEventArgs args) =>
            {
                global::System.Console.WriteLine($"FlexLayout with Column Fourth Text has been changed to \"{args.TextField.Text}\".");
            };
            flexColView.Add(flexColText4);
        }