Example #1
0
        public void Activate()
        {
            Window window = Window.Instance;

            root = new View()
            {
                Size2D = new Size2D(1920, 1080),
            };
            window.Add(root);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            createText[0]            = new TextLabel();
            createText[0].Text       = "Create Tab just by properties";
            createText[0].Size2D     = new Size2D(450, 100);
            createText[0].Position2D = new Position2D(200, 100);
            createText[0].MultiLine  = true;
            root.Add(createText[0]);

            tab                 = new Tab();
            tab.Size2D          = new Size2D(700, 108);
            tab.Position2D      = new Position2D(100, 300);
            tab.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.5f);
            //tab.IsNatureTextWidth = true;
            //tab.ItemGap = 40;
            //tab.LeftSpace = 56;
            //tab.RightSpace = 56;
            //tab.TopSpace = 1;
            //tab.BottomSpace = 0;
            tab.Style.UnderLine.Size            = new Size(1, 3);
            tab.Style.UnderLine.BackgroundColor = color[0];
            tab.Style.Text.PointSize            = 25;
            tab.Style.Text.TextColor            = new Selector <Color>
            {
                Normal   = Color.Black,
                Selected = color[0],
            };
            tab.ItemChangedEvent += TabItemChangedEvent;
            root.Add(tab);

            for (int i = 0; i < 3; i++)
            {
                Tab.TabItemData item = new Tab.TabItemData();
                item.Text = "Tab " + i;
                if (i == 1)
                {
                    item.Text = "Long Tab " + i;
                }
                tab.AddItem(item);
            }
            tab.SelectedItemIndex = 0;

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            createText[1]            = new TextLabel();
            createText[1].Text       = "Create Tab just by Attributes";
            createText[1].Size2D     = new Size2D(450, 100);
            createText[1].Position2D = new Position2D(1000, 100);
            createText[1].MultiLine  = true;
            root.Add(createText[1]);

            TabStyle attrs = new TabStyle
            {
                //IsNatureTextWidth = false,
                ItemPadding = new Extents(56, 56, 1, 0),
                UnderLine   = new ViewStyle
                {
                    Size = new Size(1, 3),
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.BottomLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.BottomLeft,
                    BackgroundColor        = new Selector <Color> {
                        All = color[0]
                    },
                },
                Text = new TextLabelStyle
                {
                    PointSize = new Selector <float?> {
                        All = 25
                    },
                    TextColor = new Selector <Color>
                    {
                        Normal   = Color.Black,
                        Selected = color[0],
                    },
                },
            };

            tab2                   = new Tab(attrs);
            tab2.Size2D            = new Size2D(500, 108);
            tab2.Position2D        = new Position2D(900, 300);
            tab2.BackgroundColor   = new Color(1.0f, 1.0f, 1.0f, 0.5f);
            tab2.ItemChangedEvent += Tab2ItemChangedEvent;
            root.Add(tab2);

            for (int i = 0; i < 3; i++)
            {
                Tab.TabItemData item = new Tab.TabItemData();
                item.Text = "Tab " + i;
                tab2.AddItem(item);
            }
            tab2.SelectedItemIndex = 0;

            button = new Button();
            button.Style.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            button.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            button.Size2D          = new Size2D(280, 80);
            button.Position2D      = new Position2D(400, 700);
            button.Style.Text.Text = mode[index];
            button.ClickEvent     += ButtonClickEvent;
            root.Add(button);

            button2 = new Button();
            button2.Style.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            button2.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            button2.Size2D          = new Size2D(580, 80);
            button2.Position2D      = new Position2D(250, 500);
            button2.Style.Text.Text = "LayoutDirection is left to right";
            button2.ClickEvent     += ButtonClickEvent2;
            root.Add(button2);
        }
Example #2
0
        private void CreateTabView()
        {
            // Init parent of TabView
            parentView[1]        = new View();
            parentView[1].Size   = new Size(1920, 200);
            parentView[1].Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Horizontal, LinearAlignment = LinearLayout.Alignment.Center, CellPadding = new Size2D(100, 0)
            };
            root.Add(parentView[1]);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            tab                           = new Tab();
            tab.Size                      = new Size(700, 108);
            tab.BackgroundColor           = new Color(1.0f, 1.0f, 1.0f, 0.5f);
            tab.Underline.Size            = new Size(1, 3);
            tab.Underline.BackgroundColor = color[0];
            tab.PointSize                 = 25;
            tab.TextColorSelector         = new ColorSelector
            {
                Normal   = Color.Black,
                Selected = color[0],
            };
            tab.ItemChangedEvent += TabItemChangedEvent;
            parentView[1].Add(tab);

            for (int i = 0; i < 3; i++)
            {
                Tab.TabItemData item = new Tab.TabItemData();
                item.Text = "Tab " + i;
                if (i == 1)
                {
                    item.Text = "Long Tab " + i;
                }
                tab.AddItem(item);
            }
            tab.SelectedItemIndex = 0;

            ///////////////////////////////////////////////Create by Style//////////////////////////////////////////////////////////
            TabStyle st = new TabStyle
            {
                //IsNatureTextWidth = false,
                ItemPadding = new Extents(56, 56, 1, 0),
                UnderLine   = new ViewStyle
                {
                    Size = new Size(1, 3),
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.BottomLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.BottomLeft,
                    BackgroundColor        = new Selector <Color> {
                        All = color[0]
                    },
                },
                Text = new TextLabelStyle
                {
                    PointSize = new Selector <float?> {
                        All = 25
                    },
                    TextColor = new Selector <Color>
                    {
                        Normal   = Color.Black,
                        Selected = color[0],
                    },
                },
            };

            tab2                   = new Tab(st);
            tab2.Size              = new Size(500, 108);
            tab2.BackgroundColor   = new Color(1.0f, 1.0f, 1.0f, 0.5f);
            tab2.ItemChangedEvent += Tab2ItemChangedEvent;
            parentView[1].Add(tab2);

            for (int i = 0; i < 3; i++)
            {
                Tab.TabItemData item = new Tab.TabItemData();
                item.Text = "Tab " + i;
                tab2.AddItem(item);
            }
            tab2.SelectedItemIndex = 0;
        }