2 * Copyright(c) 2022 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 System.ComponentModel;
20 using Tizen.NUI.BaseComponents;
21 using Tizen.NUI.Components;
23 namespace Tizen.NUI.StyleGuide
25 // IExample inehrited class will be automatically added in the main examples list.
26 internal class PaginationExample : ContentPage, IExample
28 private View rootContent;
29 private Button buttonLeft, buttonRight;
30 private TextLabel[] board = new TextLabel[2];
31 private Pagination[] pagination = new Pagination[2];
32 private View[] layout = new View[3];
33 private readonly int PAGE_COUNT = 5;
37 public void Activate()
40 public void Deactivate()
44 /// Modify this method for adding other examples.
45 public PaginationExample() : base()
47 WidthSpecification = LayoutParamPolicies.MatchParent;
48 HeightSpecification = LayoutParamPolicies.MatchParent;
50 // Navigator bar title is added here.
53 Title = "Pagination Default Style",
56 // Example root content view.
57 // you can decorate, add children on this view.
58 rootContent = new View()
60 WidthSpecification = LayoutParamPolicies.MatchParent,
61 HeightSpecification = LayoutParamPolicies.MatchParent,
63 Layout = new LinearLayout()
65 LinearOrientation = LinearLayout.Orientation.Vertical,
66 HorizontalAlignment = HorizontalAlignment.Center,
67 VerticalAlignment = VerticalAlignment.Center,
68 CellPadding = new Size2D(10, 20),
74 buttonLeft = new Button
78 WidthSpecification = LayoutParamPolicies.MatchParent,
80 rootContent.Add(buttonLeft);
82 buttonLeft.Clicked += (s, e) =>
84 if (pagination[0].SelectedIndex > 0)
86 pagination[0].SelectedIndex = pagination[0].SelectedIndex - 1;
88 if (pagination[1].SelectedIndex > 0)
90 pagination[1].SelectedIndex = pagination[1].SelectedIndex - 1;
94 buttonRight = new Button
98 WidthSpecification = LayoutParamPolicies.MatchParent,
100 rootContent.Add(buttonRight);
102 buttonRight.Clicked += (s, e) =>
104 if (pagination[0].SelectedIndex < pagination[0].IndicatorCount - 1)
106 pagination[0].SelectedIndex = pagination[0].SelectedIndex + 1;
108 if (pagination[1].SelectedIndex < pagination[1].IndicatorCount - 1)
110 pagination[1].SelectedIndex = pagination[1].SelectedIndex + 1;
114 Content = rootContent;
118 board[0] = new TextLabel();
119 board[0].Size = new Size(300, 50);
120 board[0].PointSize = 15;
121 board[0].HorizontalAlignment = HorizontalAlignment.Center;
122 board[0].VerticalAlignment = VerticalAlignment.Center;
123 board[0].BackgroundColor = Color.Magenta;
124 board[0].Text = "Property construction";
125 rootContent.Add(board[0]);
127 // Create by Properties
128 pagination[0] = new Pagination();
129 var path = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
130 var indicatorImageUrlStyle = new PaginationStyle()
132 IndicatorSize = new Size(64, 8),
133 IndicatorSpacing = 8,
134 IndicatorImageUrl = new Selector<string>
136 Normal = path + "/pagination/pagination_ic_nor.png",
137 Selected = path + "/pagination/pagination_ic_sel.png"
140 pagination[0].ApplyStyle(indicatorImageUrlStyle);
141 pagination[0].Name = "Pagination1";
142 pagination[0].Size = new Size(450, 50);
143 pagination[0].BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f);
144 pagination[0].IndicatorCount = PAGE_COUNT;
145 pagination[0].SelectedIndex = 0;
146 rootContent.Add(pagination[0]);
148 board[1] = new TextLabel();
149 board[1].Size = new Size(300, 50);
150 board[1].PointSize = 15;
151 board[1].HorizontalAlignment = HorizontalAlignment.Center;
152 board[1].VerticalAlignment = VerticalAlignment.Center;
153 board[1].BackgroundColor = Color.Magenta;
154 board[1].Text = "Attribute construction";
155 rootContent.Add(board[1]);
157 // Create by Attributes
158 PaginationStyle style = new PaginationStyle()
160 IndicatorSize = new Size(32, 4),
161 IndicatorSpacing = 20,
162 IndicatorImageUrl = new Selector<string>
164 Normal = path + "/pagination/pagination_ic_nor.png",
165 Selected = path + "/pagination/pagination_ic_sel.png"
168 pagination[1] = new Pagination(style);
169 pagination[1].Name = "Pagination2";
170 pagination[1].Size = new Size(400, 50);
171 pagination[1].BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f);
172 pagination[1].IndicatorCount = PAGE_COUNT;
173 pagination[1].SelectedIndex = 0;
174 rootContent.Add(pagination[1]);