2 * Copyright(c) 2023 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using Tizen.NUI.BaseComponents;
19 using Tizen.NUI.Components;
21 namespace NUITizenGallery
23 public partial class TabViewWithIconOnlyTestPage : ContentPage
25 private int tabCount = 2;
27 public TabViewWithIconOnlyTestPage()
29 InitializeComponent();
32 private TabButton CreateTabButton()
34 return new TabButton() { IconURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "home.png", };
37 private void AddTabClickedCb(object sender, ClickedEventArgs args)
41 tabView.AddTab(CreateTabButton(), CreateView());
46 private void RemoveTabClickedCb(object sender, ClickedEventArgs args)
50 tabView.RemoveTab(tabCount - 1);
55 private View CreateView()
57 Color backgroundColor;
58 Color buttonBackgroundColor;
60 if ((tabCount + 1) % 4 == 0)
62 backgroundColor = Color.DarkGreen;
63 buttonBackgroundColor = Color.Green;
65 else if ((tabCount + 1) % 4 == 1)
67 backgroundColor = Color.DarkRed;
68 buttonBackgroundColor = Color.Red;
70 else if ((tabCount + 1) % 4 == 2)
72 backgroundColor = Color.DarkBlue;
73 buttonBackgroundColor = Color.Blue;
77 backgroundColor = Color.SaddleBrown;
78 buttonBackgroundColor = Color.Orange;
81 var container = new View()
83 Layout = new LinearLayout()
85 LinearOrientation = LinearLayout.Orientation.Vertical,
86 HorizontalAlignment = HorizontalAlignment.Center,
87 VerticalAlignment = VerticalAlignment.Center,
88 CellPadding = new Size2D(0, 20),
90 BackgroundColor = backgroundColor,
91 WidthSpecification = LayoutParamPolicies.MatchParent,
92 HeightSpecification = LayoutParamPolicies.MatchParent,
95 var buttonAddTab = new Button()
98 BackgroundColor = buttonBackgroundColor,
100 buttonAddTab.Clicked += AddTabClickedCb;
101 container.Add(buttonAddTab);
103 var buttonRemoveTab = new Button()
106 BackgroundColor = buttonBackgroundColor,
108 buttonRemoveTab.Clicked += RemoveTabClickedCb;
109 container.Add(buttonRemoveTab);