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.Binding;
21 using Tizen.NUI.BaseComponents;
22 using Tizen.NUI.Components;
23 using Tizen.NUI.Components.Extension;
25 namespace NUITizenGallery
27 public partial class AnimalListPage : ContentPage
29 public AnimalListPage()
31 InitializeComponent();
32 BindingContext = new Animals();
35 protected override void Dispose(DisposeTypes type)
42 if (type == DisposeTypes.Explicit)
44 RemoveAllChildren(true);
50 private void RemoveAllChildren(bool dispose = false)
52 RecursiveRemoveChildren(this, dispose);
55 private void RecursiveRemoveChildren(View parent, bool dispose)
62 int maxChild = (int)parent.ChildCount;
63 for (int i = maxChild - 1; i >= 0; --i)
65 View child = parent.GetChildAt((uint)i);
71 RecursiveRemoveChildren(child, dispose);