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 RefreshViewTest1Page : ContentPage
30 public RefreshViewTest1Page()
32 InitializeComponent();
40 btn1.Clicked += (s, e) =>
46 Scroller.Remove(lbl1);
47 for (i = 1; i <= 50; i++)
49 var label = new TextLabel(DateTime.UtcNow.AddMinutes(i).ToString("F"));
50 var r = new decimal(rand.NextDouble());
51 var g = new decimal(rand.NextDouble());
52 var b = new decimal(rand.NextDouble());
53 var boxview = new View
55 Size2D = new Size2D(NUIApplication.GetDefaultWindow().WindowSize.Width, 100),
56 BackgroundColor = new Tizen.NUI.Color((float)r, (float)g, (float)b, 1.0f)
59 Scroller.Add(boxview);
64 View[] a = Scroller.Children.ToArray();
66 for (i = 0; i < a.Length; i++)
68 Scroller.Remove(a[i]);
80 protected override void Dispose(DisposeTypes type)
87 if (type == DisposeTypes.Explicit)
89 RemoveAllChildren(true);
95 private void RemoveAllChildren(bool dispose = false)
97 RecursiveRemoveChildren(this, dispose);
100 private void RecursiveRemoveChildren(View parent, bool dispose)
107 int maxChild = (int)parent.ChildCount;
108 for (int i = maxChild - 1; i >= 0; --i)
110 View child = parent.GetChildAt((uint)i);
116 RecursiveRemoveChildren(child, dispose);
117 parent.Remove(child);