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.
18 using System.ComponentModel;
19 using Tizen.NUI.Binding;
21 namespace Tizen.NUI.Components
24 /// PageAppearingEventArgs is a class to record <see cref="Page.Appearing"/> event arguments which will be sent to user.
26 /// <since_tizen> 9 </since_tizen>
27 public class PageAppearingEventArgs : EventArgs
32 /// PageDisappearingEventArgs is a class to record <see cref="Page.Disappearing"/> event arguments which will be sent to user.
34 /// <since_tizen> 9 </since_tizen>
35 public class PageDisappearingEventArgs : EventArgs
40 /// PageAppearedEventArgs is a class to record <see cref="Page.Appeared"/> event arguments which will be sent to user.
42 /// <since_tizen> 9 </since_tizen>
43 public class PageAppearedEventArgs : EventArgs
48 /// PageDisappearedEventArgs is a class to record <see cref="Page.Disappeared"/> event arguments which will be sent to user.
50 /// <since_tizen> 9 </since_tizen>
51 public class PageDisappearedEventArgs : EventArgs
56 /// The Page class is a class which is an element of navigation.
58 /// <since_tizen> 9 </since_tizen>
59 public abstract class Page : Control
62 /// AppearingTransitionProperty
64 [EditorBrowsable(EditorBrowsableState.Never)]
65 public static readonly BindableProperty AppearingTransitionProperty = BindableProperty.Create(nameof(AppearingTransition), typeof(TransitionBase), typeof(Page), null, propertyChanged: (bindable, oldValue, newValue) =>
67 var instance = (Page)bindable;
70 instance.InternalAppearingTransition = newValue as TransitionBase;
73 defaultValueCreator: (bindable) =>
75 var instance = (Page)bindable;
76 return instance.InternalAppearingTransition;
80 /// DisappearingTransitionProperty
82 [EditorBrowsable(EditorBrowsableState.Never)]
83 public static readonly BindableProperty DisappearingTransitionProperty = BindableProperty.Create(nameof(DisappearingTransition), typeof(TransitionBase), typeof(Page), null, propertyChanged: (bindable, oldValue, newValue) =>
85 var instance = (Page)bindable;
88 instance.InternalDisappearingTransition = newValue as TransitionBase;
91 defaultValueCreator: (bindable) =>
93 var instance = (Page)bindable;
94 return instance.InternalDisappearingTransition;
97 private Navigator navigator = null;
99 // Default transition is Fade.
100 private TransitionBase appearingTransition = null;
102 private TransitionBase disappearingTransition = null;
105 /// Creates a new instance of a Page.
107 /// <since_tizen> 9 </since_tizen>
108 public Page() : base()
113 /// Navigator which has pushed the Page into its stack.
114 /// If this Page has not been pushed into any Navigator, then Navigator is null.
116 /// <since_tizen> 9 </since_tizen>
117 public Navigator Navigator
125 if (navigator == value)
135 /// Transition properties for the transition of Views in this page during this page is pushed to Navigator.
137 [EditorBrowsable(EditorBrowsableState.Never)]
138 public TransitionBase AppearingTransition
142 return GetValue(AppearingTransitionProperty) as TransitionBase;
146 SetValue(AppearingTransitionProperty, value);
147 NotifyPropertyChanged();
150 private TransitionBase InternalAppearingTransition
154 appearingTransition = value;
158 return appearingTransition;
163 /// Transition properties for the transition of Views in this page during this page is popped from Navigator.
165 [EditorBrowsable(EditorBrowsableState.Never)]
166 public TransitionBase DisappearingTransition
170 return GetValue(DisappearingTransitionProperty) as TransitionBase;
174 SetValue(DisappearingTransitionProperty, value);
175 NotifyPropertyChanged();
178 private TransitionBase InternalDisappearingTransition
182 disappearingTransition = value;
186 return disappearingTransition;
191 /// Appearing event is invoked right before the page appears.
193 /// <since_tizen> 9 </since_tizen>
194 public event EventHandler<PageAppearingEventArgs> Appearing;
197 /// Disappearing event is invoked right before the page disappears.
199 /// <since_tizen> 9 </since_tizen>
200 public event EventHandler<PageDisappearingEventArgs> Disappearing;
203 /// Appeared event is invoked right after the page appears.
205 /// <since_tizen> 9 </since_tizen>
206 public event EventHandler<PageAppearedEventArgs> Appeared;
209 /// Disappeared event is invoked right after the page disappears.
211 /// <since_tizen> 9 </since_tizen>
212 public event EventHandler<PageDisappearedEventArgs> Disappeared;
214 internal void InvokeAppearing()
216 Appearing?.Invoke(this, new PageAppearingEventArgs());
219 internal void InvokeDisappearing()
221 Disappearing?.Invoke(this, new PageDisappearingEventArgs());
224 internal void InvokeAppeared()
226 Appeared?.Invoke(this, new PageAppearedEventArgs());
229 internal void InvokeDisappeared()
231 Disappeared?.Invoke(this, new PageDisappearedEventArgs());