[NUI] Add Navigator and Page classes
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Fri, 11 Sep 2020 02:40:47 +0000 (11:40 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 19 Nov 2020 09:36:46 +0000 (18:36 +0900)
To support view navigation, Navigator and Page classes are added.
Navigator class provides stack methods to manage and navigate pages.
Page class is an element of navigation.

To add Page class, XamlBinding classes related to Page are removed
because they are not used.

src/Tizen.NUI.Components/Controls/Navigation/Navigator.cs [new file with mode: 0755]
src/Tizen.NUI.Components/Controls/Navigation/Page.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/XamlBinding/IPageContainer.cs [deleted file]
src/Tizen.NUI/src/internal/XamlBinding/IPageController.cs [deleted file]
src/Tizen.NUI/src/public/XamlBinding/ContentPage.cs [deleted file]
src/Tizen.NUI/src/public/XamlBinding/Page.cs [deleted file]
src/Tizen.NUI/src/public/XamlBinding/TemplatedPage.cs [deleted file]
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/NavigatorSample.cs [new file with mode: 0755]

diff --git a/src/Tizen.NUI.Components/Controls/Navigation/Navigator.cs b/src/Tizen.NUI.Components/Controls/Navigation/Navigator.cs
new file mode 100755 (executable)
index 0000000..202554c
--- /dev/null
@@ -0,0 +1,310 @@
+/*
+ * Copyright(c) 2020 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.ComponentModel;
+using System.Threading.Tasks;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Components
+{
+    /// <summary>
+    /// The Navigator is a class which navigates pages with stack methods such
+    /// as Push and Pop.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class Navigator : Control
+    {
+        //This will be replaced with view transition class instance.
+        private Animation _curAnimation = null;
+
+        //This will be replaced with view transition class instance.
+        private Animation _newAnimation = null;
+
+        /// <summary>
+        /// Creates a new instance of a Navigator.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Navigator() : base()
+        {
+        }
+
+        /// <summary>
+        /// List of pages of Navigator.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public List<Page> NavigationPages { get; } = new List<Page>();
+
+        /// <summary>
+        /// Pushes a page to Navigator.
+        /// If the page is already in Navigator, then it is not pushed.
+        /// </summary>
+        /// <param name="page">The page to push to Navigator.</param>
+        /// <exception cref="ArgumentNullException">Thrown when the argument page is null.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Push(Page page)
+        {
+            if (page == null)
+            {
+                throw new ArgumentNullException(nameof(page), "page should not be null.");
+            }
+
+            //Duplicate page is not pushed.
+            if (NavigationPages.Contains(page)) return;
+
+            var curTop = Peek();
+
+            if (!curTop)
+            {
+                Insert(0, page);
+                return;
+            }
+
+            NavigationPages.Add(page);
+            Add(page);
+
+            //Invoke Page events
+            page.InvokeAppearing();
+            curTop.InvokeDisappearing();
+
+            //TODO: The following transition codes will be replaced with view transition.
+            if (_curAnimation)
+            {
+                _curAnimation.Stop();
+                _curAnimation.Clear();
+            }
+
+            if (_newAnimation)
+            {
+                _newAnimation.Stop();
+                _newAnimation.Clear();
+            }
+
+            _curAnimation = new Animation(1000);
+            using (var scaleVec = new Vector3(0.0f, 0.0f, 1.0f))
+            {
+                _curAnimation.AnimateTo(curTop, "Scale", scaleVec, 0, 1000);
+            }
+            _curAnimation.AnimateTo(curTop, "Opacity", 0.0f, 0, 1000);
+            _curAnimation.EndAction = Animation.EndActions.Discard;
+            _curAnimation.Play();
+
+            using (var scaleVec = new Vector3(0.0f, 0.0f, 1.0f))
+            {
+                using (var scaleProp = new Tizen.NUI.PropertyValue(scaleVec))
+                {
+                    Tizen.NUI.Object.SetProperty(page.SwigCPtr, Page.Property.SCALE, scaleProp);
+                }
+            }
+            using (var scaleProp = new Tizen.NUI.PropertyValue(0.0f))
+            {
+                Tizen.NUI.Object.SetProperty(page.SwigCPtr, Page.Property.OPACITY, scaleProp);
+            }
+            _newAnimation = new Animation(1000);
+            using (var scaleVec = new Vector3(1.0f, 1.0f, 1.0f))
+            {
+                _newAnimation.AnimateTo(page, "Scale", scaleVec, 0, 1000);
+            }
+            _newAnimation.AnimateTo(page, "Opacity", 1.0f, 0, 1000);
+            _newAnimation.Play();
+        }
+
+        /// <summary>
+        /// Pops the top page from Navigator.
+        /// </summary>
+        /// <returns>The popped page.</returns>
+        /// <exception cref="InvalidOperationException">Thrown when there is no page in Navigator.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Page Pop()
+        {
+            if (NavigationPages.Count == 0)
+            {
+                throw new InvalidOperationException("There is no page in Navigator.");
+            }
+
+            var curTop = Peek();
+
+            if (NavigationPages.Count == 1)
+            {
+                Remove(curTop);
+                return curTop;
+            }
+
+            var newTop = NavigationPages[NavigationPages.Count - 2];
+
+            //Invoke Page events
+            newTop.InvokeAppearing();
+            curTop.InvokeDisappearing();
+
+            //TODO: The following transition codes will be replaced with view transition.
+            if (_curAnimation)
+            {
+                _curAnimation.Stop();
+                _curAnimation.Clear();
+            }
+
+            if (_newAnimation)
+            {
+                _newAnimation.Stop();
+                _newAnimation.Clear();
+            }
+
+            _curAnimation = new Animation(1000);
+            using (var scaleVec = new Vector3(0.0f, 0.0f, 1.0f))
+            {
+                _curAnimation.AnimateTo(curTop, "Scale", scaleVec, 0, 1000);
+            }
+            _curAnimation.AnimateTo(curTop, "Opacity", 0.0f, 0, 1000);
+            _curAnimation.Play();
+            _curAnimation.Finished += (object sender, EventArgs e) =>
+            {
+                //Removes the current top page after transition is finished.
+                Remove(curTop);
+            };
+
+            using (var scaleVec = new Vector3(0.0f, 0.0f, 1.0f))
+            {
+                using (var scaleProp = new Tizen.NUI.PropertyValue(scaleVec))
+                {
+                    Tizen.NUI.Object.SetProperty(newTop.SwigCPtr, Page.Property.SCALE, scaleProp);
+                }
+            }
+            using (var opacityProp = new Tizen.NUI.PropertyValue(0.0f))
+            {
+                Tizen.NUI.Object.SetProperty(newTop.SwigCPtr, Page.Property.OPACITY, opacityProp);
+            }
+            _newAnimation = new Animation(1000);
+            using (var scaleVec = new Vector3(1.0f, 1.0f, 1.0f))
+            {
+                _newAnimation.AnimateTo(newTop, "Scale", scaleVec, 0, 1000);
+            }
+            _newAnimation.AnimateTo(newTop, "Opacity", 1.0f, 0, 1000);
+            _newAnimation.Play();
+
+            return curTop;
+        }
+
+        /// <summary>
+        /// Inserts a page at the specified index of Navigator.
+        /// If the page is already in Navigator, then it is not inserted.
+        /// </summary>
+        /// <param name="index">The index of Navigator where a page will be inserted.</param>
+        /// <param name="page">The page to insert to Navigator.</param>
+        /// <exception cref="ArgumentOutOfRangeException">Thrown when the argument index is less than 0, or greater than the number of pages.</exception>
+        /// <exception cref="ArgumentNullException">Thrown when the argument page is null.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Insert(int index, Page page)
+        {
+            if ((index < 0) || (index > NavigationPages.Count))
+            {
+                throw new ArgumentOutOfRangeException(nameof(index), "index should be greater than or equal to 0, and less than or equal to the number of pages.");
+            }
+
+            if (page == null)
+            {
+                throw new ArgumentNullException(nameof(page), "page should not be null.");
+            }
+
+            //Duplicate page is not pushed.
+            if (NavigationPages.Contains(page)) return;
+
+            NavigationPages.Insert(index, page);
+            Add(page);
+        }
+
+        /// <summary>
+        /// Inserts a page to Navigator before an existing page.
+        /// If the page is already in Navigator, then it is not inserted.
+        /// </summary>
+        /// <param name="before">The existing page, before which a page will be inserted.</param>
+        /// <param name="page">The page to insert to Navigator.</param>
+        /// <exception cref="ArgumentNullException">Thrown when the argument before is null.</exception>
+        /// <exception cref="ArgumentNullException">Thrown when the argument page is null.</exception>
+        /// <exception cref="ArgumentException">Thrown when the argument before does not exist in Navigator.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void InsertBefore(Page before, Page page)
+        {
+            if (before == null)
+            {
+                throw new ArgumentNullException(nameof(before), "before should not be null.");
+            }
+
+            if (page == null)
+            {
+                throw new ArgumentNullException(nameof(page), "page should not be null.");
+            }
+
+            //Find the index of before page.
+            int beforeIndex = NavigationPages.FindIndex(x => x == before);
+
+            //before does not exist in Navigator.
+            if (beforeIndex == -1)
+            {
+                throw new ArgumentException("before does not exist in Navigator.", nameof(before));
+            }
+
+            Insert(beforeIndex, page);
+        }
+
+        /// <summary>
+        /// Removes a page from Navigator.
+        /// </summary>
+        /// <param name="page">The page to remove from Navigator.</param>
+        /// <exception cref="ArgumentNullException">Thrown when the argument page is null.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Remove(Page page)
+        {
+            if (page == null)
+            {
+                throw new ArgumentNullException(nameof(page), "page should not be null.");
+            }
+
+            NavigationPages.Remove(page);
+            base.Remove(page);
+        }
+
+        /// <summary>
+        /// Removes a page at the specified index of Navigator.
+        /// </summary>
+        /// <param name="index">The index of Navigator where a page will be removed.</param>
+        /// <exception cref="ArgumentOutOfRangeException">Thrown when the index is less than 0, or greater than or equal to the number of pages.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void RemoveAt(int index)
+        {
+            if ((index < 0) || (index >= NavigationPages.Count))
+            {
+                throw new ArgumentOutOfRangeException(nameof(index), "index should be greater than or equal to 0, and less than the number of pages.");
+            }
+
+            Remove(NavigationPages[index]);
+        }
+
+        /// <summary>
+        /// Returns the page at the top of Navigator.
+        /// </summary>
+        /// <returns>The page at the top of Navigator.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Page Peek()
+        {
+            if (NavigationPages.Count == 0) return null;
+
+            return NavigationPages[NavigationPages.Count - 1];
+        }
+    }
+} //namespace Tizen.NUI
diff --git a/src/Tizen.NUI.Components/Controls/Navigation/Page.cs b/src/Tizen.NUI.Components/Controls/Navigation/Page.cs
new file mode 100755 (executable)
index 0000000..74ba842
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright(c) 2020 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.ComponentModel;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using System.Windows.Input;
+
+namespace Tizen.NUI.Components
+{
+    /// <summary>
+    /// PageAppearingEventArgs is a class to record page appearing event arguments which will be sent to user.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class PageAppearingEventArgs : EventArgs
+    {
+    }
+
+    /// <summary>
+    /// PageDisappearingEventArgs is a class to record page disappearing event arguments which will be sent to user.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class PageDisappearingEventArgs : EventArgs
+    {
+    }
+
+    /// <summary>
+    /// The Page class is a class which is an element of navigation.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class Page : Control
+    {
+        private View _content = null;
+
+        /// <summary>
+        /// Creates a new instance of a Page.
+        /// </summary>
+        /// <param name="content">The content to set to Content of Page.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Page(View content = null) : base()
+        {
+            //Page fills to parent by default.
+            WidthResizePolicy = ResizePolicyType.FillToParent;
+            HeightResizePolicy = ResizePolicyType.FillToParent;
+
+            if (content)
+            {
+                Content = content;
+            }
+        }
+
+        /// <summary>
+        /// Content of Page. Content is added to Children automatically.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public View Content
+        {
+            get
+            {
+                return _content;
+            }
+            set
+            {
+               if (_content)
+               {
+                   if (_content != value)
+                   {
+                       Remove(_content);
+                       _content = value;
+                       Add(value);
+                   }
+               }
+               else
+               {
+                   _content = value;
+                   Add(value);
+               }
+            }
+        }
+
+        /// <summary>
+        /// An event for the page appearing signal which can be used to subscribe or unsubscribe the event handler provided by the user.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public event EventHandler<PageAppearingEventArgs> Appearing;
+
+        /// <summary>
+        /// An event for the page disappearing signal which can be used to subscribe or unsubscribe the event handler provided by the user.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public event EventHandler<PageDisappearingEventArgs> Disappearing;
+
+        internal void InvokeAppearing()
+        {
+            Appearing?.Invoke(this, new PageAppearingEventArgs());
+        }
+
+        internal void InvokeDisappearing()
+        {
+            Disappearing?.Invoke(this, new PageDisappearingEventArgs());
+        }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/XamlBinding/IPageContainer.cs b/src/Tizen.NUI/src/internal/XamlBinding/IPageContainer.cs
deleted file mode 100755 (executable)
index e1aa75e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Tizen.NUI.Binding
-{
-    internal interface IPageContainer<out T> where T : Page
-    {
-        T CurrentPage { get; }
-    }
-}
\ No newline at end of file
diff --git a/src/Tizen.NUI/src/internal/XamlBinding/IPageController.cs b/src/Tizen.NUI/src/internal/XamlBinding/IPageController.cs
deleted file mode 100755 (executable)
index 46998f2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.Collections.ObjectModel;
-
-namespace Tizen.NUI.Binding
-{
-    internal interface IPageController
-    {
-        Rectangle ContainerArea { get; set; }
-
-        bool IgnoresContainerArea { get; set; }
-
-        ObservableCollection<Element> InternalChildren { get; }
-
-        void SendAppearing();
-
-        void SendDisappearing();
-    }
-}
\ No newline at end of file
diff --git a/src/Tizen.NUI/src/public/XamlBinding/ContentPage.cs b/src/Tizen.NUI/src/public/XamlBinding/ContentPage.cs
deleted file mode 100755 (executable)
index 1e46aa5..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright (c) 2019 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.Binding;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Xaml;
-using System.Collections.Generic;
-using System.IO;
-
-namespace Tizen.NUI
-{
-    /// <summary>
-    /// The ContentPage class.
-    /// </summary>
-    [ContentProperty("Content")]
-    [EditorBrowsable(EditorBrowsableState.Never)]
-    public class ContentPage : TemplatedPage
-    {
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public View Root {get; internal set;}
-
-        /// <summary>
-        /// The contents of ContentPage can be added into it.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty ContentProperty = BindableProperty.Create(nameof(Content), typeof(View), typeof(ContentPage), null, propertyChanged: (bindable, oldValue, newValue) =>
-        {
-            var self = (ContentPage)bindable;
-            if (newValue != null)
-            {
-                self.Root.Add((View)newValue);
-            }
-            var newElement = (Element)newValue;
-            if (newElement != null)
-            {
-                BindableObject.SetInheritedBindingContext(newElement, bindable.BindingContext);
-            }
-        });
-
-        /// <summary>
-        /// The contents of ContentPage can be added into it.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public View Content
-        {
-            get { return (View)GetValue(ContentProperty); }
-            set { SetValue(ContentProperty, value); }
-        }
-
-        /// <summary>
-        /// Method that is called when the binding content changes.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected override void OnBindingContextChanged()
-        {
-            base.OnBindingContextChanged();
-
-            View content = Content;
-            ControlTemplate controlTemplate = ControlTemplate;
-            if (content != null && controlTemplate != null)
-            {
-                SetInheritedBindingContext(content, BindingContext);
-            }
-        }
-
-        internal override void OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue)
-        {
-            if (oldValue == null)
-                return;
-
-            base.OnControlTemplateChanged(oldValue, newValue);
-            View content = Content;
-            ControlTemplate controlTemplate = ControlTemplate;
-            if (content != null && controlTemplate != null)
-            {
-                SetInheritedBindingContext(content, BindingContext);
-            }
-        }
-
-        /// <summary>
-        /// The constructor.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public ContentPage(Window win)
-        {
-            IsCreateByXaml = true;
-
-            Root = new View();
-            Root.WidthResizePolicy = ResizePolicyType.FillToParent;
-            Root.HeightResizePolicy = ResizePolicyType.FillToParent;
-
-            win.Add(Root);
-        }
-
-        /// <summary>
-        /// The Resources property.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public ResourceDictionary XamlResources
-        {
-            get
-            {
-                return Application.Current.XamlResources;
-            }
-
-            set
-            {
-                Application.Current.XamlResources = value;
-            }
-        }
-
-        /// <summary>
-        /// To make the ContentPage instance be disposed.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected override void Dispose(DisposeTypes type)
-        {
-            if (disposed)
-            {
-                return;
-            }
-
-            if (type == DisposeTypes.Explicit)
-            {
-                //Called by User
-                //Release your own managed resources here.
-                //You should release all of your own disposable objects here.
-            }
-
-            //Release your own unmanaged resources here.
-            //You should not access any managed member here except static instance.
-            //because the execution order of Finalizes is non-deterministic.
-            if(Root != null)
-            {
-                Root.Unparent();
-                Root.Dispose();
-                Root = null;
-            }
-            base.Dispose(type);
-        }
-
-        /// <summary>
-        /// Check whether the content is empty.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public bool IsEmpty
-        {
-            get
-            {
-                return ( Root.ChildCount == 0 ) ? true : false;
-            }
-        }
-
-        /// <summary>
-        /// Clear all contents from this ContentPage.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public void ClearContent()
-        {
-            if ( Root != null )
-            {
-                //Remove it from the window
-                Root.Unparent();
-                Root.Dispose();
-                Root = null;
-
-                //Readd to window
-                Root = new View();
-                Root.WidthResizePolicy = ResizePolicyType.FillToParent;
-                Root.HeightResizePolicy = ResizePolicyType.FillToParent;
-                NUIApplication.GetDefaultWindow().Add(Root);
-
-                ClearHandler();
-            }
-        }
-
-        private EventHandler _clearEventHandler;
-
-        /// <summary>
-        /// Clear event.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public event EventHandler ClearEvent
-        {
-            add
-            {
-                _clearEventHandler += value;
-            }
-            remove
-            {
-                _clearEventHandler -= value;
-            }
-        }
-
-        private void ClearHandler()
-        {
-            if (_clearEventHandler != null)
-            {
-                _clearEventHandler(this, null);
-            }
-        }
-
-        /// <summary>
-        /// Users can set focus logic codes here.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public virtual void SetFocus() { }
-
-        private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
-
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public Transition GetTransition(string transitionName)
-        {
-            Transition trans = null;
-            transDictionary.TryGetValue(transitionName, out trans);
-            return trans;
-        }
-
-        private void LoadTransitions()
-        {
-            foreach (string str in transitionNames)
-            {
-                string resourceName = str + ".xaml";
-                Transition trans = null;
-
-                string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
-
-                string likelyResourcePath = resource + "animation/" + resourceName;
-
-                if (File.Exists(likelyResourcePath))
-                {
-                    trans = Xaml.Extensions.LoadObject<Transition>(likelyResourcePath);
-                }
-                if (trans != null)
-                {
-                    transDictionary?.Add(trans.Name, trans);
-                }
-            }
-        }
-
-        private string[] transitionNames;
-
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public string[] TransitionNames
-        {
-            get
-            {
-                return transitionNames;
-            }
-            set
-            {
-                transitionNames = value;
-                LoadTransitions();
-            }
-        }
-    }
-}
diff --git a/src/Tizen.NUI/src/public/XamlBinding/Page.cs b/src/Tizen.NUI/src/public/XamlBinding/Page.cs
deleted file mode 100755 (executable)
index 366427e..0000000
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- * Copyright (c) 2018 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.Collections.Specialized;
-using System.ComponentModel;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI
-{
-    /// <summary>
-    /// A BaseHandle that occupies the entire screen.
-    /// </summary>
-    // [RenderWith(typeof(_PageRenderer))]
-    [EditorBrowsable(EditorBrowsableState.Never)]
-    public class Page : BaseHandle, IPageController, IElementConfiguration<Page>
-    {
-        /// <summary>
-        /// For internal use.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public const string BusySetSignalName = "NUI.BusySet";
-
-        /// <summary>
-        /// For internal use.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public const string AlertSignalName = "NUI.SendAlert";
-
-        /// <summary>
-        /// For internal use.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public const string ActionSheetSignalName = "NUI.ShowActionSheet";
-
-        internal static readonly BindableProperty IgnoresContainerAreaProperty = BindableProperty.Create(nameof(IgnoresContainerArea), typeof(bool), typeof(Page), false);
-
-        /// <summary>
-        /// Identifies the IsBusy property.
-        /// </summary>
-        internal static readonly BindableProperty IsBusyProperty = BindableProperty.Create(nameof(IsBusy), typeof(bool), typeof(Page), false, propertyChanged: (bo, o, n) => ((Page)bo).OnPageBusyChanged());
-
-        Rectangle _containerArea;
-
-        bool _hasAppeared;
-
-        ReadOnlyCollection<Element> _logicalChildren;
-
-        /// <summary>
-        /// Creates a new Page element with default values.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public Page()
-        {
-            // ToolbarItems = toolbarItems;
-            InternalChildren.CollectionChanged += InternalChildrenOnCollectionChanged;
-        }
-
-        /// <summary>
-        /// Marks the Page as busy. This will cause the platform specific global activity indicator to show a busy state.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public bool IsBusy
-        {
-            get { return (bool)GetValue(IsBusyProperty); }
-            set { SetValue(IsBusyProperty, value); }
-        }
-
-        /// <summary>
-        /// For internal use.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public Rectangle ContainerArea
-        {
-            get { return _containerArea; }
-            set
-            {
-                if (_containerArea == value)
-                    return;
-
-                _containerArea = value;
-                ForceLayout();
-            }
-        }
-
-        /// <summary>
-        /// For internal use.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public bool IgnoresContainerArea
-        {
-            get { return (bool)GetValue(IgnoresContainerAreaProperty); }
-            set { SetValue(IgnoresContainerAreaProperty, value); }
-        }
-
-        /// <summary>
-        /// For internal use.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
-
-        internal override ReadOnlyCollection<Element> LogicalChildrenInternal =>
-            _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(InternalChildren));
-
-        /// <summary>
-        /// ndicates that the Page is about to appear.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public event EventHandler Appearing;
-
-        /// <summary>
-        /// Indicates that the Page is about to cease displaying.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public event EventHandler Disappearing;
-
-        /// <summary>
-        /// Displays a native platform action sheet, allowing the application user to choose from several buttons.
-        /// </summary>
-        /// <param name="title">Title of the displayed action sheet. Must not be null.</param>
-        /// <param name="cancel">Text to be displayed in the 'Cancel' button. Can be null to hide the cancel action.</param>
-        /// <param name="destruction">Text to be displayed in the 'Destruct' button. Can be null to hide the destructive option.</param>
-        /// <param name="buttons">Text labels for additional buttons. Must not be null.</param>
-        /// <returns>An awaitable Task that displays an action sheet and returns the Text of the button pressed by the user.</returns>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public Task<string> DisplayActionSheet(string title, string cancel, string destruction, params string[] buttons)
-        {
-            var args = new ActionSheetArguments(title, cancel, destruction, buttons);
-            MessagingCenter.Send(this, ActionSheetSignalName, args);
-            return args.Result.Task;
-        }
-
-        /// <summary>
-        /// Presents an alert dialog to the application user with a single cancel button.
-        /// </summary>
-        /// <param name="title">The title of the alert dialog.</param>
-        /// <param name="message">The body text of the alert dialog.</param>
-        /// <param name="cancel">Text to be displayed on the 'Cancel' button.</param>
-        /// <returns></returns>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public Task DisplayAlert(string title, string message, string cancel)
-        {
-            return DisplayAlert(title, message, null, cancel);
-        }
-
-        /// <summary>
-        /// resents an alert dialog to the application user with an accept and a cancel button.
-        /// </summary>
-        /// <param name="title">The title of the alert dialog.</param>
-        /// <param name="message">The body text of the alert dialog.</param>
-        /// <param name="accept">Text to be displayed on the 'Accept' button.</param>
-        /// <param name="cancel">Text to be displayed on the 'Cancel' button.</param>
-        /// <returns></returns>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public Task<bool> DisplayAlert(string title, string message, string accept, string cancel)
-        {
-            if (string.IsNullOrEmpty(cancel))
-                throw new ArgumentNullException(nameof(cancel));
-
-            var args = new AlertArguments(title, message, accept, cancel);
-            MessagingCenter.Send(this, AlertSignalName, args);
-            return args.Result.Task;
-        }
-
-        /// <summary>
-        /// Forces the Page to perform a layout pass.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public void ForceLayout()
-        {
-        }
-
-        /// <summary>
-        /// Calls OnBackButtonPressed().
-        /// </summary>
-        /// <returns></returns>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public bool SendBackButtonPressed()
-        {
-            return OnBackButtonPressed();
-        }
-
-        /// <summary>
-        /// When overridden, allows application developers to customize behavior immediately prior to the Page becoming visible.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected virtual void OnAppearing()
-        {
-        }
-
-        /// <summary>
-        /// Application developers can override this method to provide behavior when the back button is pressed.
-        /// </summary>
-        /// <returns>true if consumed</returns>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected virtual bool OnBackButtonPressed()
-        {
-            var application = RealParent as Application;
-
-            var canceled = false;
-            EventHandler handler = (sender, args) => { canceled = true; };
-
-            return !canceled;
-        }
-
-        /// <summary>
-        /// Invoked whenever the binding context of the Page changes. Override this method to add class handling for this event.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected override void OnBindingContextChanged()
-        {
-            base.OnBindingContextChanged();
-        }
-
-        /// <summary>
-        /// Indicates that the preferred size of a child Element has changed.
-        /// </summary>
-        /// <param name="sender">The object that raised the event.</param>
-        /// <param name="e">The event arguments.</param>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected virtual void OnChildMeasureInvalidated(object sender, EventArgs e)
-        {
-            InvalidationTrigger trigger = (e as InvalidationEventArgs)?.Trigger ?? InvalidationTrigger.Undefined;
-            OnChildMeasureInvalidated((BaseHandle)sender, trigger);
-        }
-
-        /// <summary>
-        /// When overridden, allows the application developer to customize behavior as the Page disappears.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected virtual void OnDisappearing()
-        {
-        }
-
-        /// <summary>
-        /// Called when the Page's Parent property has changed.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected override void OnParentSet()
-        {
-            base.OnParentSet();
-        }
-
-        internal virtual void OnChildMeasureInvalidated(BaseHandle child, InvalidationTrigger trigger)
-        {
-            var container = this as IPageContainer<Page>;
-            if (container != null)
-            {
-                Page page = container.CurrentPage;
-                if (page != null)
-                {
-                    return;
-                }
-            }
-            else
-            {
-                for (var i = 0; i < LogicalChildren.Count; i++)
-                {
-                    var v = LogicalChildren[i] as BaseHandle;
-                    if (v != null)
-                    {
-                        return;
-                    }
-                }
-            }
-        }
-
-        /// <summary>
-        /// For intarnal use.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public void SendAppearing()
-        {
-            if (_hasAppeared)
-                return;
-
-            _hasAppeared = true;
-
-            if (IsBusy)
-                MessagingCenter.Send(this, BusySetSignalName, true);
-
-            OnAppearing();
-            Appearing?.Invoke(this, EventArgs.Empty);
-
-            var pageContainer = this as IPageContainer<Page>;
-            pageContainer?.CurrentPage?.SendAppearing();
-        }
-
-        /// <summary>
-        /// For intarnal use.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public void SendDisappearing()
-        {
-            if (!_hasAppeared)
-                return;
-
-            _hasAppeared = false;
-
-            if (IsBusy)
-                MessagingCenter.Send(this, BusySetSignalName, false);
-
-            var pageContainer = this as IPageContainer<Page>;
-            pageContainer?.CurrentPage?.SendDisappearing();
-
-            OnDisappearing();
-            Disappearing?.Invoke(this, EventArgs.Empty);
-        }
-
-        Application FindApplication(Element element)
-        {
-            if (element == null)
-                return null;
-
-            return (element.Parent is Application app) ? app : FindApplication(element.Parent);
-        }
-
-        void InternalChildrenOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
-        {
-            if (e.OldItems != null)
-            {
-                foreach (BaseHandle item in e.OldItems.OfType<BaseHandle>())
-                {
-                    OnInternalRemoved(item);
-                }
-            }
-
-            if (e.NewItems != null)
-            {
-                foreach (BaseHandle item in e.NewItems.OfType<BaseHandle>())
-                {
-                    OnInternalAdded(item);
-                }
-            }
-        }
-
-        private void OnInternalAdded(BaseHandle view)
-        {
-            OnChildAdded(view);
-        }
-
-        private void OnInternalRemoved(BaseHandle view)
-        {
-            OnChildRemoved(view);
-        }
-
-        void OnPageBusyChanged()
-        {
-            if (!_hasAppeared)
-                return;
-
-            MessagingCenter.Send(this, BusySetSignalName, IsBusy);
-        }
-
-        void OnToolbarItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
-        {
-            if (null != args)
-            {
-                if (args.Action != NotifyCollectionChangedAction.Add)
-                    return;
-                if (args.NewItems != null)
-                {
-                    foreach (IElement item in args.NewItems)
-                        item.Parent = this;
-                }
-            }
-        }
-
-        bool ShouldLayoutChildren()
-        {
-            if (!LogicalChildren.Any())
-            {
-                return false;
-            }
-
-            var container = this as IPageContainer<Page>;
-            if (container?.CurrentPage != null)
-            {
-                return true;
-            }
-
-            var any = false;
-            for (var i = 0; i < LogicalChildren.Count; i++)
-            {
-                var v = LogicalChildren[i] as BaseHandle;
-                if (v != null)
-                {
-                    any = true;
-                    break;
-                }
-            }
-            return !any;
-        }
-    }
-}
\ No newline at end of file
diff --git a/src/Tizen.NUI/src/public/XamlBinding/TemplatedPage.cs b/src/Tizen.NUI/src/public/XamlBinding/TemplatedPage.cs
deleted file mode 100755 (executable)
index cf2c4ef..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-using System.Collections.Generic;
-using System.ComponentModel;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI
-{
-    /// <summary>
-    /// A page that displays full-screen content with a control template, and the base class for ContentPage.
-    /// </summary>
-    [EditorBrowsable(EditorBrowsableState.Never)]
-    public class TemplatedPage : Page, IControlTemplated
-    {
-        /// <summary>
-        /// Backing store for the ControlTemplate property.
-        /// </summary>
-        internal static readonly BindableProperty ControlTemplateProperty = BindableProperty.Create(nameof(ControlTemplate), typeof(ControlTemplate), typeof(TemplatedPage), null,
-            propertyChanged: TemplateUtilities.OnControlTemplateChanged);
-
-        /// <summary>
-        /// Gets or sets the control template that is used to display content.
-        /// </summary>
-        internal ControlTemplate ControlTemplate
-        {
-            get { return (ControlTemplate)GetValue(ControlTemplateProperty); }
-            set { SetValue(ControlTemplateProperty, value); }
-        }
-
-        IList<Element> IControlTemplated.InternalChildren => InternalChildren;
-
-        // internal override void ComputeConstraintForView(View view)
-        // {
-        //     LayoutOptions vOptions = view.VerticalOptions;
-        //     LayoutOptions hOptions = view.HorizontalOptions;
-
-        //     var result = LayoutConstraint.None;
-        //     if (vOptions.Alignment == LayoutAlignment.Fill)
-        //             result |= LayoutConstraint.VerticallyFixed;
-        //     if (hOptions.Alignment == LayoutAlignment.Fill)
-        //             result |= LayoutConstraint.HorizontallyFixed;
-
-        //     view.ComputedConstraint = result;
-        // }
-
-        internal override void SetChildInheritedBindingContext(Element child, object context)
-        {
-            if (ControlTemplate == null)
-                base.SetChildInheritedBindingContext(child, context);
-        }
-
-        void IControlTemplated.OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue)
-        {
-            OnControlTemplateChanged(oldValue, newValue);
-        }
-
-        internal virtual void OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue)
-        {
-        }
-    }
-}
\ No newline at end of file
diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/NavigatorSample.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/NavigatorSample.cs
new file mode 100755 (executable)
index 0000000..74ece7b
--- /dev/null
@@ -0,0 +1,101 @@
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+    public class NavigatorSample : IExample
+    {
+        private Navigator navigator;
+        private Page firstPage, secondPage;
+        private Button firstButton, secondButton;
+
+        public void Activate()
+        {
+            Window window = NUIApplication.GetDefaultWindow();
+
+            navigator = new Navigator()
+            {
+                WidthResizePolicy = ResizePolicyType.FillToParent,
+                HeightResizePolicy = ResizePolicyType.FillToParent
+            };
+            window.Add(navigator);
+
+            CreateFirstPage();
+        }
+
+        private void CreateFirstPage()
+        {
+            firstButton = new Button()
+            {
+                Text = "First Page",
+                WidthResizePolicy = ResizePolicyType.FillToParent,
+                HeightResizePolicy = ResizePolicyType.FillToParent,
+            };
+            firstButton.Clicked += (object sender, ClickedEventArgs e) =>
+            {
+                CreateSecondPage();
+            };
+
+            firstPage = new Page(firstButton);
+            firstPage.Appearing += (object sender, PageAppearingEventArgs e) =>
+            {
+                global::System.Console.WriteLine("First Page is appearing!");
+            };
+            firstPage.Disappearing += (object sender, PageDisappearingEventArgs e) =>
+            {
+                global::System.Console.WriteLine("First Page is disappearing!");
+            };
+
+            navigator.Push(firstPage);
+        }
+
+        private void CreateSecondPage()
+        {
+            secondButton = new Button()
+            {
+                Text = "Second Page",
+                WidthResizePolicy = ResizePolicyType.FillToParent,
+                HeightResizePolicy = ResizePolicyType.FillToParent,
+            };
+            secondButton.Clicked += (object sender, ClickedEventArgs e) =>
+            {
+                navigator.Pop();
+            };
+
+            secondPage = new Page(secondButton);
+            secondPage.Appearing += (object sender, PageAppearingEventArgs e) =>
+            {
+                global::System.Console.WriteLine("Second Page is appearing!");
+            };
+            secondPage.Disappearing += (object sender, PageDisappearingEventArgs e) =>
+            {
+                global::System.Console.WriteLine("Second Page is disappearing!");
+            };
+
+            navigator.Push(secondPage);
+        }
+
+        public void Deactivate()
+        {
+            if (navigator != null)
+            {
+                NUIApplication.GetDefaultWindow().Remove(navigator);
+
+                firstButton.Dispose();
+                firstButton = null;
+
+                secondButton.Dispose();
+                secondButton = null;
+
+                firstPage.Dispose();
+                firstPage = null;
+
+                secondPage.Dispose();
+                secondPage = null;
+
+                navigator.Dispose();
+                navigator = null;
+            }
+        }
+    }
+}