2 * Copyright(c) 2021 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.
19 using Tizen.NUI.BaseComponents;
20 using Tizen.NUI.Components;
22 namespace NUITizenGallery
24 public partial class GridTest3Page : ContentPage
26 public GridTest3Page()
28 InitializeComponent();
29 var btnStyle = new ButtonStyle();
30 var btnStyle1 = new ButtonStyle();
31 var btnStyle2 = new ButtonStyle();
32 var btnStyle3 = new ButtonStyle();
33 btnStyle.BackgroundColor = new Selector<Tizen.NUI.Color>
35 Normal = Tizen.NUI.Color.Blue,
36 Pressed = Tizen.NUI.Color.DarkBlue,
38 btnStyle1.BackgroundColor = new Selector<Tizen.NUI.Color>
40 Normal = Tizen.NUI.Color.Red,
41 Pressed = Tizen.NUI.Color.DarkRed,
43 btnStyle2.BackgroundColor = new Selector<Tizen.NUI.Color>
45 Normal = Tizen.NUI.Color.LightSeaGreen,
46 Pressed = Tizen.NUI.Color.SeaGreen,
48 btnStyle3.BackgroundColor = new Selector<Tizen.NUI.Color>
50 Normal = Tizen.NUI.Color.Yellow,
51 Pressed = Tizen.NUI.Color.Orange,
54 btnClear.ApplyStyle(btnStyle);
55 btnUp.ApplyStyle(btnStyle);
56 btnProc.ApplyStyle(btnStyle);
57 btnDiv.ApplyStyle(btnStyle);
58 btnMultiply.ApplyStyle(btnStyle);
59 btnMinus.ApplyStyle(btnStyle);
60 btnPlus.ApplyStyle(btnStyle);
61 btnDot.ApplyStyle(btnStyle3);
62 btnEqual.ApplyStyle(btnStyle1);
63 btn0.ApplyStyle(btnStyle2);
64 btn1.ApplyStyle(btnStyle2);
65 btn2.ApplyStyle(btnStyle2);
66 btn3.ApplyStyle(btnStyle2);
67 btn4.ApplyStyle(btnStyle2);
68 btn5.ApplyStyle(btnStyle2);
69 btn6.ApplyStyle(btnStyle2);
70 btn7.ApplyStyle(btnStyle2);
71 btn8.ApplyStyle(btnStyle2);
72 btn9.ApplyStyle(btnStyle2);
74 protected override void Dispose(DisposeTypes type)
81 if (type == DisposeTypes.Explicit)
83 RemoveAllChildren(true);
89 private void RemoveAllChildren(bool dispose = false)
91 RecursiveRemoveChildren(this, dispose);
94 private void RecursiveRemoveChildren(View parent, bool dispose)
101 int maxChild = (int)parent.ChildCount;
102 for (int i = maxChild - 1; i >= 0; --i)
104 View child = parent.GetChildAt((uint)i);
110 RecursiveRemoveChildren(child, dispose);
111 parent.Remove(child);