--- /dev/null
+/*
+ * Copyright(c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+
+namespace NUITizenGallery
+{
+ internal class AnimalGrid : IExample
+ {
+ private Window window;
+
+ public void Activate()
+ {
+ Console.WriteLine($"@@@ this.GetType().Name={this.GetType().Name}, Activate()");
+
+ window = NUIApplication.GetDefaultWindow();
+ window.GetDefaultNavigator().Push(new AnimalGridPage());
+ }
+ public void Deactivate()
+ {
+ Console.WriteLine($"@@@ this.GetType().Name={this.GetType().Name}, Deactivate()");
+ window.GetDefaultNavigator().Pop();
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.Binding;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using Tizen.NUI.Components.Extension;
+
+namespace NUITizenGallery
+{
+ public partial class AnimalGridPage : ContentPage
+ {
+ public AnimalGridPage()
+ {
+ InitializeComponent();
+ BindingContext = new Animals();
+ }
+
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (Disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ RemoveAllChildren(true);
+ }
+
+ base.Dispose(type);
+ }
+
+ private void RemoveAllChildren(bool dispose = false)
+ {
+ RecursiveRemoveChildren(this, dispose);
+ }
+
+ private void RecursiveRemoveChildren(View parent, bool dispose)
+ {
+ if (parent == null)
+ {
+ return;
+ }
+
+ int maxChild = (int)parent.ChildCount;
+ for (int i = maxChild - 1; i >= 0; --i)
+ {
+ View child = parent.GetChildAt((uint)i);
+ if (child == null)
+ {
+ continue;
+ }
+
+ RecursiveRemoveChildren(child, dispose);
+ parent.Remove(child);
+ if (dispose)
+ {
+ child.Dispose();
+ }
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<ContentPage x:Class="NUITizenGallery.AnimalGridPage"
+ xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+ HeightSpecification="{Static LayoutParamPolicies.MatchParent}" >
+
+ <!-- AppBar is top-side bar with navigation content, title, and action. If you not set any contents, back button is automatically added. -->
+ <ContentPage.AppBar>
+ <AppBar x:Name="appBar" Title="AnimalGridPage"/>
+ </ContentPage.AppBar>
+
+ <!-- Content is main placeholder of ContentPage. Add your content into this view. -->
+ <ContentPage.Content>
+ <View x:Name="ContentView"
+ WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+ HeightSpecification="{Static LayoutParamPolicies.MatchParent}">
+
+ <View.Layout>
+ <LinearLayout LinearOrientation="Vertical" LinearAlignment="Top" CellPadding="10,10" />
+ </View.Layout>
+
+ <CollectionView x:Name="ColView"
+ WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+ HeightSpecification="{Static LayoutParamPolicies.MatchParent}"
+ ScrollingDirection="Vertical"
+ ItemsSource="{Binding Source}"
+ HideScrollbar="true"
+ SelectionMode="None">
+
+ <CollectionView.ItemsLayouter>
+ <GridLayouter />
+ </CollectionView.ItemsLayouter>
+ <CollectionView.ItemTemplate>
+ <DataTemplate>
+ <DefaultGridItem
+ WidthSpecification="230"
+ HeightSpecification="200"
+ Text="{Binding Path=Name}"
+ ResourceUrl="{Binding Path=ImagePath}">
+ <DefaultGridItem.Badge>
+ <CheckBox />
+ </DefaultGridItem.Badge>
+ </DefaultGridItem>
+ </DataTemplate>
+ </CollectionView.ItemTemplate>
+
+
+ </CollectionView>
+ </View>
+ </ContentPage.Content>
+</ContentPage>
--- /dev/null
+/*
+ * Copyright(c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+
+namespace NUITizenGallery
+{
+ internal class AnimalList : IExample
+ {
+ private Window window;
+
+ public void Activate()
+ {
+ Console.WriteLine($"@@@ this.GetType().Name={this.GetType().Name}, Activate()");
+
+ window = NUIApplication.GetDefaultWindow();
+ window.GetDefaultNavigator().Push(new AnimalListPage());
+ }
+ public void Deactivate()
+ {
+ Console.WriteLine($"@@@ this.GetType().Name={this.GetType().Name}, Deactivate()");
+ window.GetDefaultNavigator().Pop();
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.Binding;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using Tizen.NUI.Components.Extension;
+
+namespace NUITizenGallery
+{
+ public partial class AnimalListPage : ContentPage
+ {
+ public AnimalListPage()
+ {
+ InitializeComponent();
+ BindingContext = new Animals();
+ }
+
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (Disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ RemoveAllChildren(true);
+ }
+
+ base.Dispose(type);
+ }
+
+ private void RemoveAllChildren(bool dispose = false)
+ {
+ RecursiveRemoveChildren(this, dispose);
+ }
+
+ private void RecursiveRemoveChildren(View parent, bool dispose)
+ {
+ if (parent == null)
+ {
+ return;
+ }
+
+ int maxChild = (int)parent.ChildCount;
+ for (int i = maxChild - 1; i >= 0; --i)
+ {
+ View child = parent.GetChildAt((uint)i);
+ if (child == null)
+ {
+ continue;
+ }
+
+ RecursiveRemoveChildren(child, dispose);
+ parent.Remove(child);
+ if (dispose)
+ {
+ child.Dispose();
+ }
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<ContentPage x:Class="NUITizenGallery.AnimalListPage"
+ xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+ HeightSpecification="{Static LayoutParamPolicies.MatchParent}" >
+
+ <!-- AppBar is top-side bar with navigation content, title, and action. If you not set any contents, back button is automatically added. -->
+ <ContentPage.AppBar>
+ <AppBar x:Name="appBar" Title="AnimalListPage"/>
+ </ContentPage.AppBar>
+
+ <!-- Content is main placeholder of ContentPage. Add your content into this view. -->
+ <ContentPage.Content>
+ <View x:Name="ContentView"
+ WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+ HeightSpecification="{Static LayoutParamPolicies.MatchParent}">
+
+ <View.Layout>
+ <LinearLayout LinearOrientation="Vertical" LinearAlignment="Top" CellPadding="10,10" />
+ </View.Layout>
+
+ <CollectionView x:Name="ColView"
+ WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+ HeightSpecification="{Static LayoutParamPolicies.MatchParent}"
+ ScrollingDirection="Vertical"
+ ItemsSource="{Binding Source}"
+ HideScrollbar="true"
+ SelectionMode="None">
+
+ <CollectionView.ItemsLayouter>
+ <LinearLayouter />
+ </CollectionView.ItemsLayouter>
+ <CollectionView.ItemTemplate>
+ <DataTemplate>
+ <DefaultLinearItem
+ WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+ Text="{Binding Path=Name}"
+ SubText="{Binding Path=ScientificName}">
+ <DefaultLinearItem.Icon>
+ <ImageView
+ WidthSpecification="70"
+ HeightSpecification="50"
+ ResourceUrl="{Binding Path=ImagePath}" />
+ </DefaultLinearItem.Icon>
+ <DefaultLinearItem.Extra>
+ <CheckBox />
+ </DefaultLinearItem.Extra>
+ </DefaultLinearItem>
+ </DataTemplate>
+ </CollectionView.ItemTemplate>
+
+
+ </CollectionView>
+ </View>
+ </ContentPage.Content>
+</ContentPage>
--- /dev/null
+/*
+ * Copyright(c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.Binding;
+
+public class Animal : INotifyPropertyChanged
+{
+ private string _name;
+ private string _scientificName;
+ private string _imageUrl = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/animals/";
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ private void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }
+
+
+ public Animal(string name, string scientificName)
+ {
+ _name = name;
+ _scientificName = scientificName;
+ }
+
+ public string Name
+ {
+ get => _name;
+ set
+ {
+ _name = value;
+ OnPropertyChanged("Name");
+ }
+ }
+
+ public string ScientificName
+ {
+ get => _scientificName;
+ set
+ {
+ _scientificName = value;
+ OnPropertyChanged("ScientificName");
+ }
+ }
+
+ public string ImagePath
+ {
+ get
+ {
+ string filename = _name.Replace(" ", "");
+ filename = filename.ToLower() + ".jpg";
+ return _imageUrl + filename;
+ }
+ }
+}
+
+
+public class Animals
+{
+ (string Name,string ScientificName)[] namePool = {
+ ("Bald Eagle", "Haliaeetus leucocephalus"),
+ ("Bear", "Ursidae"),
+ ("Cat", "Felis catus"),
+ ("Chicken", "Gallus gallus domesticus"),
+ ("Cow", "Bos taurus"),
+ ("Deer", "Cervidae"),
+ ("Dog", "Canis lupus familiaris"),
+ ("Duck", "Anatidae"),
+ ("Elephant", "Elephantidae"),
+ ("Emperor Penguin", "Aptenodytes forsteri"),
+ ("Giraffe", "Giraffa"),
+ ("Horse", "Equus ferus"),
+ ("Leopard", "Panthera pardus"),
+ ("Lion", "Panthera leo"),
+ ("Panda", "Ailuropoda melanoleuca"),
+ ("Peacock", "Pavo cristatus"),
+ ("Pig", "Sus scrofa domesticus"),
+ ("Pigeon", "Columba livia"),
+ ("Red Fox", "Vulpes vulpes"),
+ ("Seagull", "Larus canus"),
+ ("Squirrel", "Sciurus vulgaris"),
+ ("Tiger", "Panthera tigris"),
+ ("Wolf", "Canis lupus"),
+ ("Zebra", "Hippotigris"),
+};
+ public ObservableCollection<Animal> Source {get; private set; } = new ObservableCollection<Animal>();
+
+ public Animals()
+ {
+ for (int i = 0; i < namePool.Length; i++)
+ Source.Add(new Animal(namePool[i].Name, namePool[i].ScientificName));
+ }
+}
</ItemGroup>
<PropertyGroup>
- <XamlOptimization>2</XamlOptimization>
+ <XamlOptimization>1</XamlOptimization>
</PropertyGroup>
<ImportGroup>