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.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
23 namespace Tizen.NUI.BaseComponents
26 /// View is the base class for all views.
28 /// <since_tizen> 3 </since_tizen>
29 public partial class View : Container, IResourcesProvider
31 private static HashSet<BindableProperty> positionPropertyGroup = new HashSet<BindableProperty>();
32 private static HashSet<BindableProperty> sizePropertyGroup = new HashSet<BindableProperty>();
33 private static HashSet<BindableProperty> scalePropertyGroup = new HashSet<BindableProperty>();
35 internal BackgroundExtraData backgroundExtraData;
37 private bool layoutSet = false;
38 private LayoutItem layout; // Exclusive layout assigned to this View.
40 // List of transitions paired with the condition that uses the transition.
41 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
42 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
43 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
44 private float weight = 0.0f; // Weighting of child View in a Layout
45 private bool backgroundImageSynchronousLoading = false;
46 private bool excludeLayouting = false;
47 private LayoutTransition layoutTransition;
48 private TransitionOptions transitionOptions = null;
49 private ThemeData themeData;
51 // List of constraints
52 private Constraint widthConstraint = null;
53 private Constraint heightConstraint = null;
55 private Size2D internalMaximumSize = null;
56 private Size2D internalMinimumSize = null;
57 private Extents internalMargin = null;
58 private Extents internalPadding = null;
59 private Vector3 internalSizeModeFactor = null;
60 private Vector2 internalCellIndex = null;
61 private Color internalBackgroundColor = null;
62 private Color internalColor = null;
63 private Position internalPivotPoint = null;
64 private Position internalPosition = null;
65 private Position2D internalPosition2D = null;
66 private Vector3 internalScale = null;
67 private Size internalSize = null;
68 private Size2D internalSize2D = null;
69 private int layoutCount = 0;
73 RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
74 RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
75 RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
76 RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);
78 RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
79 RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
80 RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
81 RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);
83 RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
84 RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
85 RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
86 RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
90 /// Creates a new instance of a view.
92 /// <since_tizen> 3 </since_tizen>
93 public View() : this(Interop.View.New(), true)
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
99 [EditorBrowsable(EditorBrowsableState.Never)]
100 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
105 /// Create a new instance of a View with setting the status of shown or hidden.
107 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
108 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
109 [EditorBrowsable(EditorBrowsableState.Never)]
110 public View(bool shown) : this(Interop.View.New(), true)
112 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
127 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
129 InitializeStyle(viewStyle);
132 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
136 PositionUsesPivotPoint = false;
139 onWindowSendEventCallback = SendViewAddedEventToWindow;
140 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
141 signal?.Connect(onWindowSendEventCallback);
149 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
151 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160 /// The event that is triggered when the View's ControlState is changed.
162 [EditorBrowsable(EditorBrowsableState.Never)]
163 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
165 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
169 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
171 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
172 [EditorBrowsable(EditorBrowsableState.Never)]
173 public bool LayoutSet
182 /// Flag to allow Layouting to be disabled for Views.
183 /// Once a View has a Layout set then any children added to Views from then on will receive
184 /// automatic Layouts.
186 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
187 [EditorBrowsable(EditorBrowsableState.Never)]
188 public static bool LayoutingDisabled { get; set; } = true;
191 /// Deprecate. Please do not use this.
192 /// The style instance applied to this view.
193 /// Note that please do not modify the ViewStyle.
194 /// Modifying ViewStyle will affect other views with same ViewStyle.
196 [EditorBrowsable(EditorBrowsableState.Never)]
197 protected ViewStyle ViewStyle
201 if (themeData == null) themeData = new ThemeData();
203 if (themeData.viewStyle == null)
205 ApplyStyle(CreateViewStyle());
207 return themeData.viewStyle;
212 /// Get/Set the control state.
213 /// Note that the ControlState only available for the classes derived from Control.
214 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
215 /// please set <see cref="EnableControlState"/> to true.
217 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public ControlState ControlState
223 return themeData == null ? ControlState.Normal : themeData.controlStates;
227 if (ControlState == value)
232 var prevState = ControlState;
234 if (themeData == null) themeData = new ThemeData();
235 themeData.controlStates = value;
237 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
239 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
241 if (themeData.ControlStatePropagation)
243 foreach (View child in Children)
245 child.ControlState = value;
249 OnControlStateChanged(changeInfo);
251 ControlStateChangedEvent?.Invoke(this, changeInfo);
256 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
258 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
259 [EditorBrowsable(EditorBrowsableState.Never)]
260 public bool ExcludeLayouting
264 return (bool)GetValue(ExcludeLayoutingProperty);
268 SetValue(ExcludeLayoutingProperty, value);
269 NotifyPropertyChanged();
273 private bool InternalExcludeLayouting
277 return excludeLayouting;
281 excludeLayouting = value;
282 if (Layout != null && Layout.SetPositionByLayout == value)
284 Layout.SetPositionByLayout = !value;
285 Layout.RequestLayout();
290 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
291 [EditorBrowsable(EditorBrowsableState.Never)]
292 public bool IsResourcesCreated
296 return Application.Current.IsResourcesCreated;
300 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
301 [EditorBrowsable(EditorBrowsableState.Never)]
302 public ResourceDictionary XamlResources
306 return Application.Current.XamlResources;
310 Application.Current.XamlResources = value;
315 /// The StyleName, type string.
316 /// The value indicates DALi style name defined in json theme file.
318 /// <since_tizen> 3 </since_tizen>
319 public string StyleName
323 return (string)GetValue(StyleNameProperty);
327 SetValue(StyleNameProperty, value);
328 NotifyPropertyChanged();
333 /// The KeyInputFocus, type bool.
335 [EditorBrowsable(EditorBrowsableState.Never)]
336 public bool KeyInputFocus
340 return (bool)GetValue(KeyInputFocusProperty);
344 SetValue(KeyInputFocusProperty, value);
345 NotifyPropertyChanged();
350 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
354 /// The property cascade chaining set is not recommended.
357 /// Animatable - This property can be animated using <c>Animation</c> class.
359 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
364 /// This way is recommended for setting the property
366 /// var view = new View();
367 /// view.BackgroundColor = new Color(0.5f, 0.1f, 0, 1);
369 /// This way to set the property is prohibited
371 /// view.BackgroundColor.R = 0.5f; //This does not guarantee a proper operation
374 /// <since_tizen> 3 </since_tizen>
375 public Color BackgroundColor
379 return (Color)GetValue(BackgroundColorProperty);
383 SetValue(BackgroundColorProperty, value);
384 NotifyPropertyChanged();
389 /// The mutually exclusive with "backgroundColor" and "background" type Map.
391 /// <since_tizen> 3 </since_tizen>
392 public string BackgroundImage
396 return (string)GetValue(BackgroundImageProperty);
400 SetValue(BackgroundImageProperty, value);
401 NotifyPropertyChanged();
406 /// Get or set the border of background image.
408 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
409 [EditorBrowsable(EditorBrowsableState.Never)]
410 public Rectangle BackgroundImageBorder
414 return (Rectangle)GetValue(BackgroundImageBorderProperty);
418 SetValue(BackgroundImageBorderProperty, value);
419 NotifyPropertyChanged();
424 /// The background of view.
426 /// <since_tizen> 3 </since_tizen>
427 public Tizen.NUI.PropertyMap Background
431 return (PropertyMap)GetValue(BackgroundProperty);
435 SetValue(BackgroundProperty, value);
436 NotifyPropertyChanged();
441 /// Describes a shadow as an image for a View.
442 /// It is null by default.
445 /// Getter returns copied instance of current shadow.
448 /// The mutually exclusive with "BoxShadow".
452 /// Animatable - This property can be animated using <c>Animation</c> class.
453 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
455 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
457 /// Animatable sub-property : Offset.
460 [EditorBrowsable(EditorBrowsableState.Never)]
461 public ImageShadow ImageShadow
465 return (ImageShadow)GetValue(ImageShadowProperty);
469 SetValue(ImageShadowProperty, value);
470 NotifyPropertyChanged();
475 /// Describes a box shaped shadow drawing for a View.
476 /// It is null by default.
479 /// The mutually exclusive with "ImageShadow".
483 /// Animatable - This property can be animated using <c>Animation</c> class.
484 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
486 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
488 /// Animatable sub-property : Offset, Color, BlurRadius.
491 /// <since_tizen> 9 </since_tizen>
492 public Shadow BoxShadow
496 return (Shadow)GetValue(BoxShadowProperty);
500 SetValue(BoxShadowProperty, value);
501 NotifyPropertyChanged();
506 /// The radius for the rounded corners of the View.
507 /// This will rounds background and shadow edges.
508 /// The values in Vector4 are used in clockwise order from top-left to bottom-left : Vector4(top-left-corner, top-right-corner, bottom-right-corner, bottom-left-corner).
509 /// Each radius will clamp internally to the half of smaller of the view's width or height.
510 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
514 /// Animatable - This property can be animated using <c>Animation</c> class.
516 /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10));
520 /// <since_tizen> 9 </since_tizen>
521 public Vector4 CornerRadius
525 return (Vector4)GetValue(CornerRadiusProperty);
529 SetValue(CornerRadiusProperty, value);
530 NotifyPropertyChanged();
535 /// Whether the CornerRadius property value is relative (percentage [0.0f to 0.5f] of the view size) or absolute (in world units).
536 /// It is absolute by default.
537 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
539 /// <since_tizen> 9 </since_tizen>
540 public VisualTransformPolicyType CornerRadiusPolicy
542 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
543 set => SetValue(CornerRadiusPolicyProperty, value);
547 /// The width for the borderline of the View.
551 /// Animatable - This property can be animated using <c>Animation</c> class.
553 /// animation.AnimateTo(view, "BorderlineWidth", 100.0f);
556 /// Note that, an image background may not have borderline if it uses the Border property.
558 /// <since_tizen> 9 </since_tizen>
559 public float BorderlineWidth
563 return (float)GetValue(BorderlineWidthProperty);
567 SetValue(BorderlineWidthProperty, value);
568 NotifyPropertyChanged();
573 /// The color for the borderline of the View.
574 /// It is Color.Black by default.
578 /// Animatable - This property can be animated using <c>Animation</c> class.
580 /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a));
584 /// <since_tizen> 9 </since_tizen>
585 public Color BorderlineColor
589 return (Color)GetValue(BorderlineColorProperty);
593 SetValue(BorderlineColorProperty, value);
594 NotifyPropertyChanged();
599 /// The Relative offset for the borderline of the View.
600 /// Recommended range : [-1.0f to 1.0f].
601 /// If -1.0f, draw borderline inside of the View.
602 /// If 1.0f, draw borderline outside of the View.
603 /// If 0.0f, draw borderline half inside and half outside.
604 /// It is 0.0f by default.
608 /// Animatable - This property can be animated using <c>Animation</c> class.
610 /// animation.AnimateTo(view, "BorderlineOffset", -1.0f);
614 /// <since_tizen> 9 </since_tizen>
615 public float BorderlineOffset
619 return (float)GetValue(BorderlineOffsetProperty);
623 SetValue(BorderlineOffsetProperty, value);
624 NotifyPropertyChanged();
629 /// The current state of the view.
631 /// <since_tizen> 3 </since_tizen>
636 return (States)GetValue(StateProperty);
640 SetValue(StateProperty, value);
641 NotifyPropertyChanged();
646 /// The current sub state of the view.
648 /// <since_tizen> 3 </since_tizen>
649 public States SubState
653 return (States)GetValue(SubStateProperty);
657 SetValue(SubStateProperty, value);
658 NotifyPropertyChanged();
663 /// Displays a tooltip
665 /// <since_tizen> 3 </since_tizen>
666 public Tizen.NUI.PropertyMap Tooltip
670 return (PropertyMap)GetValue(TooltipProperty);
674 SetValue(TooltipProperty, value);
675 NotifyPropertyChanged();
680 /// Displays a tooltip as a text.
682 /// <since_tizen> 3 </since_tizen>
683 public string TooltipText
687 return GetValue(TooltipTextProperty) as string;
691 SetValue(TooltipTextProperty, value);
695 private string InternalTooltipText
699 using (var propertyValue = GetProperty(Property.TOOLTIP))
701 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
703 return retrivedValue;
705 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
706 return "error to get TooltipText";
711 var temp = new Tizen.NUI.PropertyValue(value);
712 SetProperty(View.Property.TOOLTIP, temp);
714 NotifyPropertyChanged();
719 /// The Child property of FlexContainer.<br />
720 /// The proportion of the free space in the container, the flex item will receive.<br />
721 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
723 /// <since_tizen> 3 </since_tizen>
724 [Obsolete("Deprecated in API8, will be removed in API10.")]
729 return (float)GetValue(FlexProperty);
733 SetValue(FlexProperty, value);
734 NotifyPropertyChanged();
739 /// The Child property of FlexContainer.<br />
740 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
742 /// <since_tizen> 3 </since_tizen>
743 [Obsolete("Deprecated in API8, will be removed in API10.")]
748 return (int)GetValue(AlignSelfProperty);
752 SetValue(AlignSelfProperty, value);
753 NotifyPropertyChanged();
758 /// The Child property of FlexContainer.<br />
759 /// The space around the flex item.<br />
762 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
764 /// <since_tizen> 3 </since_tizen>
765 [Obsolete("Deprecated in API8, will be removed in API10.")]
766 public Vector4 FlexMargin
770 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
771 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
775 SetValue(FlexMarginProperty, value);
776 NotifyPropertyChanged();
781 /// The top-left cell this child occupies, if not set, the first available cell is used.
784 /// The property cascade chaining set is not recommended.
785 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
788 /// This way is recommended for setting the property
790 /// var view = new View();
791 /// view.CellIndex = new Vector2(1, 3);
793 /// This way to set the property is prohibited
795 /// view.CellIndex.X = 1; //This does not guarantee a proper operation
798 /// <since_tizen> 3 </since_tizen>
799 public Vector2 CellIndex
803 return (Vector2)GetValue(CellIndexProperty);
807 SetValue(CellIndexProperty, value);
808 NotifyPropertyChanged();
813 /// The number of rows this child occupies, if not set, the default value is 1.
816 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
818 /// <since_tizen> 3 </since_tizen>
823 return (float)GetValue(RowSpanProperty);
827 SetValue(RowSpanProperty, value);
828 NotifyPropertyChanged();
833 /// The number of columns this child occupies, if not set, the default value is 1.
836 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
838 /// <since_tizen> 3 </since_tizen>
839 public float ColumnSpan
843 return (float)GetValue(ColumnSpanProperty);
847 SetValue(ColumnSpanProperty, value);
848 NotifyPropertyChanged();
853 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
856 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
858 /// <since_tizen> 3 </since_tizen>
859 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
863 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
867 SetValue(CellHorizontalAlignmentProperty, value);
868 NotifyPropertyChanged();
873 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
876 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
878 /// <since_tizen> 3 </since_tizen>
879 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
883 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
887 SetValue(CellVerticalAlignmentProperty, value);
888 NotifyPropertyChanged();
893 /// The left focusable view.<br />
894 /// This will return null if not set.<br />
895 /// This will also return null if the specified left focusable view is not on a window.<br />
897 /// <since_tizen> 3 </since_tizen>
898 public View LeftFocusableView
900 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
903 return (View)GetValue(LeftFocusableViewProperty);
907 SetValue(LeftFocusableViewProperty, value);
908 NotifyPropertyChanged();
913 /// The right focusable view.<br />
914 /// This will return null if not set.<br />
915 /// This will also return null if the specified right focusable view is not on a window.<br />
917 /// <since_tizen> 3 </since_tizen>
918 public View RightFocusableView
920 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
923 return (View)GetValue(RightFocusableViewProperty);
927 SetValue(RightFocusableViewProperty, value);
928 NotifyPropertyChanged();
933 /// The up focusable view.<br />
934 /// This will return null if not set.<br />
935 /// This will also return null if the specified up focusable view is not on a window.<br />
937 /// <since_tizen> 3 </since_tizen>
938 public View UpFocusableView
940 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
943 return (View)GetValue(UpFocusableViewProperty);
947 SetValue(UpFocusableViewProperty, value);
948 NotifyPropertyChanged();
953 /// The down focusable view.<br />
954 /// This will return null if not set.<br />
955 /// This will also return null if the specified down focusable view is not on a window.<br />
957 /// <since_tizen> 3 </since_tizen>
958 public View DownFocusableView
960 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
963 return (View)GetValue(DownFocusableViewProperty);
967 SetValue(DownFocusableViewProperty, value);
968 NotifyPropertyChanged();
973 /// Whether the view should be focusable by keyboard navigation.
975 /// <since_tizen> 3 </since_tizen>
976 public bool Focusable
980 SetValue(FocusableProperty, value);
981 NotifyPropertyChanged();
985 return (bool)GetValue(FocusableProperty);
990 /// Whether the children of this view can be focusable by keyboard navigation. If user sets this to false, the children of this actor view will not be focused.
991 /// Note : Default value is true.
993 [EditorBrowsable(EditorBrowsableState.Never)]
994 public bool FocusableChildren
998 SetValue(FocusableChildrenProperty, value);
999 NotifyPropertyChanged();
1003 return (bool)GetValue(FocusableChildrenProperty);
1008 /// Whether this view can focus by touch.
1009 /// If Focusable is false, FocusableInTouch is disabled.
1010 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
1012 [EditorBrowsable(EditorBrowsableState.Never)]
1013 public bool FocusableInTouch
1017 SetValue(FocusableInTouchProperty, value);
1018 NotifyPropertyChanged();
1022 return (bool)GetValue(FocusableInTouchProperty);
1027 /// Retrieves the position of the view.<br />
1028 /// The coordinates are relative to the view's parent.<br />
1030 /// <since_tizen> 3 </since_tizen>
1031 public Position CurrentPosition
1035 return GetCurrentPosition();
1040 /// Sets the size of a view for the width and the height.<br />
1041 /// Geometry can be scaled to fit within this area.<br />
1042 /// This does not interfere with the view's scale factor.<br />
1043 /// The views default depth is the minimum of width and height.<br />
1046 /// The property cascade chaining set is not recommended.
1049 /// This way is recommended for setting the property
1051 /// var view = new View();
1052 /// view.Size2D = new Size2D(100, 200);
1054 /// This way to set the property is prohibited
1056 /// view.Size2D.Width = 100; //This does not guarantee a proper operation
1059 /// <since_tizen> 3 </since_tizen>
1060 public Size2D Size2D
1064 var temp = (Size2D)GetValue(Size2DProperty);
1066 if (this.Layout == null)
1068 if (temp.Width < 0) { temp.Width = 0; }
1069 if (temp.Height < 0) { temp.Height = 0; }
1076 SetValue(Size2DProperty, value);
1078 NotifyPropertyChanged();
1083 /// Retrieves the size of the view.<br />
1084 /// The coordinates are relative to the view's parent.<br />
1086 /// <since_tizen> 3 </since_tizen>
1087 public Size2D CurrentSize
1091 return GetCurrentSize();
1096 /// Retrieves and sets the view's opacity.<br />
1100 /// Animatable - This property can be animated using <c>Animation</c> class.
1102 /// animation.AnimateTo(view, "Opacity", 0.5f);
1106 /// <since_tizen> 3 </since_tizen>
1107 public float Opacity
1111 return (float)GetValue(OpacityProperty);
1115 SetValue(OpacityProperty, value);
1116 NotifyPropertyChanged();
1121 /// Sets the position of the view for X and Y.<br />
1122 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1123 /// If the position inheritance is disabled, sets the world position.<br />
1126 /// The property cascade chaining set is not recommended.
1129 /// This way is recommended for setting the property
1131 /// var view = new View();
1132 /// view.Position2D = new Position2D(100, 200);
1134 /// This way to set the property is prohibited
1136 /// view.Position2D.X = 100; //This does not guarantee a proper operation
1139 /// <since_tizen> 3 </since_tizen>
1140 public Position2D Position2D
1144 return (Position2D)GetValue(Position2DProperty);
1148 SetValue(Position2DProperty, value);
1149 NotifyPropertyChanged();
1154 /// Retrieves the screen position of the view.<br />
1156 /// <since_tizen> 3 </since_tizen>
1157 public Vector2 ScreenPosition
1161 Vector2 temp = new Vector2(0.0f, 0.0f);
1162 var pValue = GetProperty(View.Property.ScreenPosition);
1170 /// Determines whether the pivot point should be used to determine the position of the view.
1171 /// This is false by default.
1173 /// <remarks>If false, then the top-left of the view is used for the position.
1174 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1176 /// <since_tizen> 3 </since_tizen>
1177 public bool PositionUsesPivotPoint
1181 return (bool)GetValue(PositionUsesPivotPointProperty);
1185 SetValue(PositionUsesPivotPointProperty, value);
1186 NotifyPropertyChanged();
1191 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1193 /// <since_tizen> 3 </since_tizen>
1194 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1196 "View view = new View(); " +
1197 "view.PivotPoint = PivotPoint.Center; " +
1198 "view.PositionUsesPivotPoint = true;" +
1199 " Deprecated in API5: Will be removed in API8")]
1200 [EditorBrowsable(EditorBrowsableState.Never)]
1201 public bool PositionUsesAnchorPoint
1205 return (bool)GetValue(PositionUsesAnchorPointProperty);
1209 SetValue(PositionUsesAnchorPointProperty, value);
1213 private bool InternalPositionUsesAnchorPoint
1218 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1219 pValue.Get(out temp);
1225 var temp = new Tizen.NUI.PropertyValue(value);
1226 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1228 NotifyPropertyChanged();
1233 /// Queries whether the view is connected to the stage.<br />
1234 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1236 /// <since_tizen> 3 </since_tizen>
1237 public bool IsOnWindow
1246 /// Gets the depth in the hierarchy for the view.
1248 /// <since_tizen> 3 </since_tizen>
1249 public int HierarchyDepth
1253 return GetHierarchyDepth();
1258 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1261 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1262 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1263 /// The values set by this property will likely change.
1265 /// <since_tizen> 3 </since_tizen>
1266 public int SiblingOrder
1270 return (int)GetValue(SiblingOrderProperty);
1274 SetValue(SiblingOrderProperty, value);
1276 Layout?.ChangeLayoutSiblingOrder(value);
1278 NotifyPropertyChanged();
1283 /// Returns the natural size of the view.
1286 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1288 /// <since_tizen> 5 </since_tizen>
1289 public Vector3 NaturalSize
1293 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1294 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1300 /// Returns the natural size (Size2D) of the view.
1303 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1305 /// <since_tizen> 4 </since_tizen>
1306 public Size2D NaturalSize2D
1310 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1311 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1313 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1320 /// Gets or sets the origin of a view within its parent's area.<br />
1321 /// This is expressed in unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent, and (1.0, 1.0, 0.5) is the bottom-right corner.<br />
1322 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1323 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1325 /// <pre>The view has been initialized.</pre>
1326 /// <since_tizen> 3 </since_tizen>
1327 public Position ParentOrigin
1331 Position tmp = (Position)GetValue(ParentOriginProperty);
1332 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1336 SetValue(ParentOriginProperty, value);
1337 NotifyPropertyChanged();
1342 /// Gets or sets the anchor-point of a view.<br />
1343 /// This is expressed in unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the view, and (1.0, 1.0, 0.5) is the bottom-right corner.<br />
1344 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1345 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1346 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1347 /// <pre>The view has been initialized.</pre>
1350 /// The property cascade chaining set is not recommended.
1353 /// This way is recommended for setting the property
1355 /// var view = new View();
1356 /// view.PivotPoint = PivotPoint.Center;
1358 /// This way to set the property is prohibited
1360 /// view.PivotPoint.X = 0.5f; //This does not guarantee a proper operation
1363 /// <since_tizen> 3 </since_tizen>
1364 public Position PivotPoint
1368 return (Position)GetValue(PivotPointProperty);
1372 SetValue(PivotPointProperty, value);
1373 NotifyPropertyChanged();
1378 /// Gets or sets the size width of the view.
1382 /// Animatable - This property can be animated using <c>Animation</c> class.
1384 /// animation.AnimateTo(view, "SizeWidth", 500.0f);
1388 /// <since_tizen> 3 </since_tizen>
1389 public float SizeWidth
1393 return (float)GetValue(SizeWidthProperty);
1397 SetValue(SizeWidthProperty, value);
1398 NotifyPropertyChanged();
1403 /// Gets or sets the size height of the view.
1407 /// Animatable - This property can be animated using <c>Animation</c> class.
1410 /// animation.AnimateTo(view, "SizeHeight", 500.0f);
1413 /// <since_tizen> 3 </since_tizen>
1414 public float SizeHeight
1418 return (float)GetValue(SizeHeightProperty);
1422 SetValue(SizeHeightProperty, value);
1423 NotifyPropertyChanged();
1428 /// Gets or sets the position of the view.<br />
1429 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1430 /// If the position inheritance is disabled, sets the world position.<br />
1434 /// Animatable - This property can be animated using <c>Animation</c> class.
1436 /// animation.AnimateTo(view, "Position", new Position(50, 0));
1439 /// The property cascade chaining set is not recommended.
1442 /// This way is recommended for setting the property
1444 /// var view = new View();
1445 /// view.Position = new Position(100, 200.5f, 0);
1447 /// This way to set the property is prohibited
1449 /// view.Position.Y = 200.5f; //This does not guarantee a proper operation
1452 /// <since_tizen> 3 </since_tizen>
1453 public Position Position
1457 return (Position)GetValue(PositionProperty);
1461 SetValue(PositionProperty, value);
1462 NotifyPropertyChanged();
1467 /// Gets or sets the position X of the view.
1471 /// Animatable - This property can be animated using <c>Animation</c> class.
1473 /// animation.AnimateTo(view, "PositionX", 50.0f);
1477 /// <since_tizen> 3 </since_tizen>
1478 public float PositionX
1482 return (float)GetValue(PositionXProperty);
1486 SetValue(PositionXProperty, value);
1487 NotifyPropertyChanged();
1492 /// Gets or sets the position Y of the view.
1496 /// Animatable - This property can be animated using <c>Animation</c> class.
1498 /// animation.AnimateTo(view, "PositionY", 50.0f);
1502 /// <since_tizen> 3 </since_tizen>
1503 public float PositionY
1507 return (float)GetValue(PositionYProperty);
1511 SetValue(PositionYProperty, value);
1512 NotifyPropertyChanged();
1517 /// Gets or sets the position Z of the view.
1521 /// Animatable - This property can be animated using <c>Animation</c> class.
1523 /// animation.AnimateTo(view, "PositionZ", 50.0f);
1527 /// <since_tizen> 3 </since_tizen>
1528 public float PositionZ
1532 return (float)GetValue(PositionZProperty);
1536 SetValue(PositionZProperty, value);
1537 NotifyPropertyChanged();
1542 /// Gets or sets the world position of the view.
1544 /// <since_tizen> 3 </since_tizen>
1545 public Vector3 WorldPosition
1549 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1550 var pValue = GetProperty(View.Property.WorldPosition);
1558 /// Gets or sets the orientation of the view.<br />
1559 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1563 /// This is an asynchronous method.
1566 /// Animatable - This property can be animated using <c>Animation</c> class.
1568 /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis));
1572 /// <since_tizen> 3 </since_tizen>
1573 public Rotation Orientation
1577 return (Rotation)GetValue(OrientationProperty);
1581 SetValue(OrientationProperty, value);
1582 NotifyPropertyChanged();
1587 /// Gets or sets the world orientation of the view.<br />
1589 /// <since_tizen> 3 </since_tizen>
1590 public Rotation WorldOrientation
1594 Rotation temp = new Rotation();
1595 var pValue = GetProperty(View.Property.WorldOrientation);
1603 /// Gets or sets the scale factor applied to the view.<br />
1607 /// Animatable - This property can be animated using <c>Animation</c> class.
1609 /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f));
1612 /// The property cascade chaining set is not recommended.
1615 /// This way is recommended for setting the property
1617 /// var view = new View();
1618 /// view.Scale = new Vector3(1.5f, 2.0f, 1.0f);
1620 /// This way to set the property is prohibited
1622 /// view.Scale.Width = 1.5f; //This does not guarantee a proper operation
1625 /// <since_tizen> 3 </since_tizen>
1626 public Vector3 Scale
1630 return (Vector3)GetValue(ScaleProperty);
1634 SetValue(ScaleProperty, value);
1635 NotifyPropertyChanged();
1640 /// Gets or sets the scale X factor applied to the view.
1644 /// Animatable - This property can be animated using <c>Animation</c> class.
1646 /// animation.AnimateTo(view, "ScaleX", 1.5f);
1650 /// <since_tizen> 3 </since_tizen>
1655 return (float)GetValue(ScaleXProperty);
1659 SetValue(ScaleXProperty, value);
1660 NotifyPropertyChanged();
1665 /// Gets or sets the scale Y factor applied to the view.
1669 /// Animatable - This property can be animated using <c>Animation</c> class.
1671 /// animation.AnimateTo(view, "ScaleY", 1.5f);
1675 /// <since_tizen> 3 </since_tizen>
1680 return (float)GetValue(ScaleYProperty);
1684 SetValue(ScaleYProperty, value);
1685 NotifyPropertyChanged();
1690 /// Gets or sets the scale Z factor applied to the view.
1694 /// Animatable - This property can be animated using <c>Animation</c> class.
1696 /// animation.AnimateTo(view, "ScaleZ", 1.5f);
1700 /// <since_tizen> 3 </since_tizen>
1705 return (float)GetValue(ScaleZProperty);
1709 SetValue(ScaleZProperty, value);
1710 NotifyPropertyChanged();
1715 /// Gets the world scale of the view.
1717 /// <since_tizen> 3 </since_tizen>
1718 public Vector3 WorldScale
1722 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1723 var pValue = GetProperty(View.Property.WorldScale);
1731 /// Retrieves the visibility flag of the view.
1735 /// If the view is not visible, then the view and its children will not be rendered.
1736 /// This is regardless of the individual visibility values of the children, i.e., the view will only be rendered if all of its parents have visibility set to true.
1739 /// Animatable - This property can be animated using <c>Animation</c> class.
1741 /// animation.AnimateTo(view, "Visibility", false);
1745 /// <since_tizen> 3 </since_tizen>
1746 public bool Visibility
1751 var pValue = GetProperty(View.Property.VISIBLE);
1752 pValue.Get(out temp);
1759 /// Gets the view's world color.
1761 /// <since_tizen> 3 </since_tizen>
1762 public Vector4 WorldColor
1766 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1767 var pValue = GetProperty(View.Property.WorldColor);
1775 /// Gets or sets the view's name.
1777 /// <since_tizen> 3 </since_tizen>
1782 return (string)GetValue(NameProperty);
1786 SetValue(NameProperty, value);
1787 NotifyPropertyChanged();
1792 /// Get the number of children held by the view.
1794 /// <since_tizen> 3 </since_tizen>
1795 public new uint ChildCount
1799 return Convert.ToUInt32(Children.Count);
1804 /// Gets the view's ID.
1807 /// <since_tizen> 3 </since_tizen>
1817 /// Gets or sets the status of whether the view should emit touch or hover signals.
1818 /// If a View is made insensitive, then the View and its children are not hittable.
1820 /// <since_tizen> 3 </since_tizen>
1821 public bool Sensitive
1825 return (bool)GetValue(SensitiveProperty);
1829 SetValue(SensitiveProperty, value);
1830 NotifyPropertyChanged();
1835 /// Gets or sets the status of whether the view should receive a notification when touch or hover motion events leave the boundary of the view.
1837 /// <since_tizen> 3 </since_tizen>
1838 public bool LeaveRequired
1842 return (bool)GetValue(LeaveRequiredProperty);
1846 SetValue(LeaveRequiredProperty, value);
1847 NotifyPropertyChanged();
1852 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1854 /// <since_tizen> 3 </since_tizen>
1855 public bool InheritOrientation
1859 return (bool)GetValue(InheritOrientationProperty);
1863 SetValue(InheritOrientationProperty, value);
1864 NotifyPropertyChanged();
1869 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1871 /// <since_tizen> 3 </since_tizen>
1872 public bool InheritScale
1876 return (bool)GetValue(InheritScaleProperty);
1880 SetValue(InheritScaleProperty, value);
1881 NotifyPropertyChanged();
1886 /// Gets or sets the status of how the view and its children should be drawn.<br />
1887 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1888 /// If an object is in a 3D layer, it will be depth-tested against other objects in the world, i.e., it may be obscured if other objects are in front.<br />
1889 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1890 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1891 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1893 /// <since_tizen> 3 </since_tizen>
1894 public DrawModeType DrawMode
1898 return (DrawModeType)GetValue(DrawModeProperty);
1902 SetValue(DrawModeProperty, value);
1903 NotifyPropertyChanged();
1908 /// Gets or sets the relative to parent size factor of the view.<br />
1909 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1910 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1913 /// The property cascade chaining set is not recommended.
1916 /// This way is recommended for setting the property
1918 /// var text = new TextField();
1919 /// text.SizeModeFactor = new Vector3(1.0f, 0.45f, 1.0f);
1921 /// This way to set the property is prohibited
1923 /// text.SizeModeFactor.Width = 1.0f; //This does not guarantee a proper operation
1926 /// <since_tizen> 3 </since_tizen>
1927 public Vector3 SizeModeFactor
1931 return (Vector3)GetValue(SizeModeFactorProperty);
1935 SetValue(SizeModeFactorProperty, value);
1936 NotifyPropertyChanged();
1941 /// Gets or sets the width resize policy to be used.
1943 /// <since_tizen> 3 </since_tizen>
1944 public ResizePolicyType WidthResizePolicy
1948 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1952 SetValue(WidthResizePolicyProperty, value);
1953 NotifyPropertyChanged();
1958 /// Gets or sets the height resize policy to be used.
1960 /// <since_tizen> 3 </since_tizen>
1961 public ResizePolicyType HeightResizePolicy
1965 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1969 SetValue(HeightResizePolicyProperty, value);
1970 NotifyPropertyChanged();
1975 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1976 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1978 /// <since_tizen> 3 </since_tizen>
1979 public SizeScalePolicyType SizeScalePolicy
1983 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1987 SetValue(SizeScalePolicyProperty, value);
1988 NotifyPropertyChanged();
1993 /// Gets or sets the status of whether the width size is dependent on the height size.
1995 /// <since_tizen> 3 </since_tizen>
1996 public bool WidthForHeight
2000 return (bool)GetValue(WidthForHeightProperty);
2004 SetValue(WidthForHeightProperty, value);
2005 NotifyPropertyChanged();
2010 /// Gets or sets the status of whether the height size is dependent on the width size.
2012 /// <since_tizen> 3 </since_tizen>
2013 public bool HeightForWidth
2017 return (bool)GetValue(HeightForWidthProperty);
2021 SetValue(HeightForWidthProperty, value);
2022 NotifyPropertyChanged();
2027 /// Gets or sets the padding for use in layout.
2030 /// The property cascade chaining set is not recommended.
2033 /// This way is recommended for setting the property
2035 /// var view = new View();
2036 /// view.Padding = new Extents(5, 5, 5, 5);
2038 /// This way to set the property is prohibited
2040 /// view.Padding.Start = 5; //This does not guarantee a proper operation
2043 /// <since_tizen> 5 </since_tizen>
2044 public Extents Padding
2048 // If View has a Layout then padding in stored in the base Layout class
2051 return Layout.Padding;
2055 return (Extents)GetValue(PaddingProperty);
2057 // Two return points to prevent creating a zeroed Extent native object before assignment
2061 Extents padding = value;
2064 // Layout set so store Padding in LayoutItem instead of in View.
2065 // If View stores the Padding value then Legacy Size Negotiation will overwrite
2066 // the position and sizes measure in the Layouting.
2067 Layout.Padding = value;
2068 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2069 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2070 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
2072 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
2076 SetValue(PaddingProperty, padding);
2077 NotifyPropertyChanged();
2082 /// Gets or sets the minimum size the view can be assigned in size negotiation.
2084 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2086 /// The property cascade chaining set is not recommended.
2089 /// This way is recommended for setting the property
2091 /// var view = new View();
2092 /// view.MinimumSize = new Size2D(100, 200);
2094 /// This way to set the property is prohibited
2096 /// view.MinimumSize.Width = 100; //This does not guarantee a proper operation
2099 /// <since_tizen> 3 </since_tizen>
2100 public Size2D MinimumSize
2104 return (Size2D)GetValue(MinimumSizeProperty);
2110 throw new ArgumentNullException(nameof(value));
2114 // Note: it only works if minimum size is >= than natural size.
2115 // To force the size it should be done through the width&height spec or Size2D.
2116 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
2117 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
2118 layout.RequestLayout();
2120 SetValue(MinimumSizeProperty, value);
2121 NotifyPropertyChanged();
2126 /// Gets or sets the maximum size the view can be assigned in size negotiation.
2129 /// This way is recommended for setting the property
2131 /// var view = new View();
2132 /// view.MaximumSize = new Size2D(100, 200);
2134 /// This way to set the property is prohibited
2136 /// view.MaximumSize.Height = 200; //This does not guarantee a proper operation
2139 /// <since_tizen> 3 </since_tizen>
2140 public Size2D MaximumSize
2144 return (Size2D)GetValue(MaximumSizeProperty);
2148 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
2149 // MATCH_PARENT spec + parent container size can be used to limit
2152 layout.RequestLayout();
2154 SetValue(MaximumSizeProperty, value);
2155 NotifyPropertyChanged();
2160 /// Gets or sets whether a child view inherits it's parent's position.<br />
2161 /// Default is to inherit.<br />
2162 /// Switching this off means that using position sets the view's world position, i.e., translates from the world origin (0,0,0) to the pivot point of the view.<br />
2164 /// <since_tizen> 3 </since_tizen>
2165 public bool InheritPosition
2169 return (bool)GetValue(InheritPositionProperty);
2173 SetValue(InheritPositionProperty, value);
2174 NotifyPropertyChanged();
2179 /// Gets or sets the clipping behavior (mode) of it's children.
2181 /// <since_tizen> 3 </since_tizen>
2182 public ClippingModeType ClippingMode
2186 return (ClippingModeType)GetValue(ClippingModeProperty);
2190 SetValue(ClippingModeProperty, value);
2191 NotifyPropertyChanged();
2196 /// Gets the number of renderers held by the view.
2198 /// <since_tizen> 3 </since_tizen>
2199 public uint RendererCount
2203 return GetRendererCount();
2208 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2211 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2213 /// <since_tizen> 3 </since_tizen>
2214 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2216 "View view = new View(); " +
2217 "view.PivotPoint = PivotPoint.Center; " +
2218 "view.PositionUsesPivotPoint = true;")]
2219 [EditorBrowsable(EditorBrowsableState.Never)]
2220 public Position AnchorPoint
2224 return GetValue(AnchorPointProperty) as Position;
2228 SetValue(AnchorPointProperty, value);
2232 private Position InternalAnchorPoint
2236 Position temp = new Position(0.0f, 0.0f, 0.0f);
2237 var pValue = GetProperty(View.Property.AnchorPoint);
2240 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2246 var temp = new Tizen.NUI.PropertyValue(value);
2247 SetProperty(View.Property.AnchorPoint, temp);
2249 NotifyPropertyChanged();
2254 /// Sets the size of a view for the width, the height and the depth.<br />
2255 /// Geometry can be scaled to fit within this area.<br />
2256 /// This does not interfere with the view's scale factor.<br />
2257 /// The views default depth is the minimum of width and height.<br />
2261 /// Animatable - This property can be animated using <c>Animation</c> class.
2263 /// animation.AnimateTo(view, "Size", new Size(100, 100));
2266 /// The property cascade chaining set is not recommended.
2269 /// This way is recommended for setting the property
2271 /// var view = new View();
2272 /// view.Size = new Size(100.5f, 200, 0);
2274 /// This way to set the property is prohibited
2276 /// view.Size.Width = 100.5f; //This does not guarantee a proper operation
2279 /// <since_tizen> 5 </since_tizen>
2284 return (Size)GetValue(SizeProperty);
2288 SetValue(SizeProperty, value);
2289 NotifyPropertyChanged();
2294 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2296 /// <since_tizen> 3 </since_tizen>
2297 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2299 "Container parent = view.GetParent(); " +
2300 "View view = parent as View;")]
2301 [EditorBrowsable(EditorBrowsableState.Never)]
2302 public new View Parent
2307 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2308 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2309 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2311 if (basehandle is Layer layer)
2313 ret = new View(Layer.getCPtr(layer).Handle, false);
2314 NUILog.Error("This Parent property is deprecated, should do not be used");
2318 ret = basehandle as View;
2321 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2322 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2330 /// Gets/Sets whether inherit parent's the layout Direction.
2332 /// <since_tizen> 4 </since_tizen>
2333 public bool InheritLayoutDirection
2337 return (bool)GetValue(InheritLayoutDirectionProperty);
2341 SetValue(InheritLayoutDirectionProperty, value);
2342 NotifyPropertyChanged();
2347 /// Gets/Sets the layout Direction.
2349 /// <since_tizen> 4 </since_tizen>
2350 public ViewLayoutDirectionType LayoutDirection
2354 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2358 SetValue(LayoutDirectionProperty, value);
2359 NotifyPropertyChanged();
2360 layout?.RequestLayout();
2365 /// Gets or sets the Margin for use in layout.
2368 /// Margin property is supported by Layout algorithms and containers.
2369 /// Please Set Layout if you want to use Margin property.
2370 /// The property cascade chaining set is not recommended.
2373 /// This way is recommended for setting the property
2375 /// var view = new View();
2376 /// view.Margin = new Extents(10, 5, 15, 20);
2378 /// This way to set the property is prohibited
2380 /// view.Margin.Top = 15; //This does not guarantee a proper operation
2383 /// <since_tizen> 4 </since_tizen>
2384 public Extents Margin
2388 // If View has a Layout then margin is stored in Layout.
2391 return Layout.Margin;
2395 // If Layout not set then return margin stored in View.
2396 return (Extents)GetValue(MarginProperty);
2398 // Two return points to prevent creating a zeroed Extent native object before assignment
2404 // Layout set so store Margin in LayoutItem instead of View.
2405 // If View stores the Margin too then the Legacy Size Negotiation will
2406 // overwrite the position and size values measured in the Layouting.
2407 Layout.Margin = value;
2408 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2409 layout?.RequestLayout();
2413 SetValue(MarginProperty, value);
2415 NotifyPropertyChanged();
2416 layout?.RequestLayout();
2421 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2425 /// // matchParentView matches its size to its parent size.
2426 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2427 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2429 /// // wrapContentView wraps its children with their desired size.
2430 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2431 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2433 /// // exactSizeView shows itself with an exact size.
2434 /// exactSizeView.WidthSpecification = 100;
2435 /// exactSizeView.HeightSpecification = 100;
2438 /// <since_tizen> 6 </since_tizen>
2439 [Binding.TypeConverter(typeof(IntGraphicsTypeConverter))]
2440 public int WidthSpecification
2444 return (int)GetValue(WidthSpecificationProperty);
2448 SetValue(WidthSpecificationProperty, value);
2449 NotifyPropertyChanged();
2453 private int InternalWidthSpecification
2461 if (value == widthPolicy)
2464 widthPolicy = value;
2465 if (widthPolicy >= 0)
2467 if (heightPolicy >= 0) // Policy an exact value
2469 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2470 Size2D = new Size2D(widthPolicy, heightPolicy);
2473 layout?.RequestLayout();
2478 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2482 /// // matchParentView matches its size to its parent size.
2483 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2484 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2486 /// // wrapContentView wraps its children with their desired size.
2487 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2488 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2490 /// // exactSizeView shows itself with an exact size.
2491 /// exactSizeView.WidthSpecification = 100;
2492 /// exactSizeView.HeightSpecification = 100;
2495 /// <since_tizen> 6 </since_tizen>
2496 [Binding.TypeConverter(typeof(IntGraphicsTypeConverter))]
2497 public int HeightSpecification
2501 return (int)GetValue(HeightSpecificationProperty);
2505 SetValue(HeightSpecificationProperty, value);
2506 NotifyPropertyChanged();
2510 private int InternalHeightSpecification
2514 return heightPolicy;
2518 if (value == heightPolicy)
2521 heightPolicy = value;
2522 if (heightPolicy >= 0)
2524 if (widthPolicy >= 0) // Policy an exact value
2526 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2527 Size2D = new Size2D(widthPolicy, heightPolicy);
2530 layout?.RequestLayout();
2535 /// Gets the List of transitions for this View.
2537 /// <since_tizen> 6 </since_tizen>
2538 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2542 if (layoutTransitions == null)
2544 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2546 return layoutTransitions;
2551 /// Sets a layout transitions for this View.
2553 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2555 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2557 /// <since_tizen> 6 </since_tizen>
2558 public LayoutTransition LayoutTransition
2562 return GetValue(LayoutTransitionProperty) as LayoutTransition;
2566 SetValue(LayoutTransitionProperty, value);
2567 NotifyPropertyChanged();
2571 private LayoutTransition InternalLayoutTransition
2575 return layoutTransition;
2581 throw new global::System.ArgumentNullException(nameof(value));
2583 if (layoutTransitions == null)
2585 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2588 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2590 AttachTransitionsToChildren(value);
2592 layoutTransition = value;
2597 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2600 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2602 /// <since_tizen> 4 </since_tizen>
2603 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2604 [EditorBrowsable(EditorBrowsableState.Never)]
2605 public Extents PaddingEX
2609 return GetValue(PaddingEXProperty) as Extents;
2613 SetValue(PaddingEXProperty, value);
2617 private Extents InternalPaddingEX
2621 Extents temp = new Extents(0, 0, 0, 0);
2622 var pValue = GetProperty(View.Property.PADDING);
2625 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2631 var temp = new Tizen.NUI.PropertyValue(value);
2632 SetProperty(View.Property.PADDING, temp);
2634 NotifyPropertyChanged();
2635 layout?.RequestLayout();
2639 [EditorBrowsable(EditorBrowsableState.Never)]
2640 public XamlStyle XamlStyle
2644 return (XamlStyle)GetValue(XamlStyleProperty);
2648 SetValue(XamlStyleProperty, value);
2653 /// The Color of View. This is an RGBA value.
2657 /// Animatable - This property can be animated using <c>Animation</c> class.
2659 /// The property cascade chaining set is not recommended.
2662 /// This way is recommended for setting the property
2664 /// var view = new View();
2665 /// view.Color = new Color(0.5f, 0.2f, 0.1f, 0.5f);
2667 /// This way to set the property is prohibited
2669 /// view.Color.A = 0.5f; //This does not guarantee a proper operation
2672 [EditorBrowsable(EditorBrowsableState.Never)]
2677 return (Color)GetValue(ColorProperty);
2681 SetValue(ColorProperty, value);
2682 NotifyPropertyChanged();
2687 /// Set the layout on this View. Replaces any existing Layout.
2690 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2692 /// <since_tizen> 6 </since_tizen>
2693 public LayoutItem Layout
2697 return GetValue(LayoutProperty) as LayoutItem;
2701 SetValue(LayoutProperty, value);
2705 private LayoutItem InternalLayout
2713 // Do nothing if layout provided is already set on this View.
2714 if (value == layout)
2719 LayoutingDisabled = false;
2722 // If new layout being set already has a owner then that owner receives a replacement default layout.
2723 // First check if the layout to be set already has a owner.
2724 if (value?.Owner != null)
2726 // Previous owner of the layout gets a default layout as a replacement.
2727 value.Owner.Layout = new AbsoluteLayout()
2729 // Copy Margin and Padding to replacement LayoutGroup.
2730 Margin = value.Margin,
2731 Padding = value.Padding,
2735 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2736 // View if no replacement. Previously margin and padding values would have been moved from
2737 // the View to the layout.
2738 if (layout != null) // Existing layout
2742 // Existing layout being replaced so copy over margin and padding values.
2743 value.Margin = layout.Margin;
2744 value.Padding = layout.Padding;
2745 value.SetPositionByLayout = !excludeLayouting;
2749 // Layout not being replaced so restore margin and padding to View.
2750 SetValue(MarginProperty, layout.Margin);
2751 SetValue(PaddingProperty, layout.Padding);
2752 NotifyPropertyChanged();
2757 // First Layout to be added to the View hence copy
2759 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2762 Extents margin = Margin;
2763 Extents padding = Padding;
2764 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2766 // If View already has a margin set then store it in Layout instead.
2767 value.Margin = margin;
2768 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2769 NotifyPropertyChanged();
2772 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2774 // If View already has a padding set then store it in Layout instead.
2775 value.Padding = padding;
2777 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2778 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2779 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2781 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2782 NotifyPropertyChanged();
2786 value.SetPositionByLayout = !excludeLayouting;
2790 // Remove existing layout from it's parent layout group.
2793 // Set layout to this view
2799 /// The weight of the View, used to share available space in a layout with siblings.
2801 /// <since_tizen> 6 </since_tizen>
2811 layout?.RequestLayout();
2816 /// Whether to load the BackgroundImage synchronously.
2817 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2818 /// Note: For Normal Quad images only.
2820 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2821 [EditorBrowsable(EditorBrowsableState.Never)]
2822 public bool BackgroundImageSynchronosLoading
2826 return (bool)GetValue(BackgroundImageSynchronosLoadingProperty);
2830 SetValue(BackgroundImageSynchronosLoadingProperty, value);
2831 NotifyPropertyChanged();
2835 private bool InternalBackgroundImageSynchronosLoading
2839 return BackgroundImageSynchronousLoading;
2843 BackgroundImageSynchronousLoading = value;
2848 /// Whether to load the BackgroundImage synchronously.
2849 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2850 /// Note: For Normal Quad images only.
2852 /// This will be public opened in tizen_7.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2853 [EditorBrowsable(EditorBrowsableState.Never)]
2854 public bool BackgroundImageSynchronousLoading
2858 return (bool)GetValue(BackgroundImageSynchronousLoadingProperty);
2862 SetValue(BackgroundImageSynchronousLoadingProperty, value);
2863 NotifyPropertyChanged();
2867 private bool InternalBackgroundImageSynchronousLoading
2871 return backgroundImageSynchronousLoading;
2875 backgroundImageSynchronousLoading = value;
2877 string bgUrl = null;
2878 var pValue = Background.Find(ImageVisualProperty.URL);
2879 pValue?.Get(out bgUrl);
2882 if (!string.IsNullOrEmpty(bgUrl))
2884 PropertyMap bgMap = this.Background;
2885 var temp = new PropertyValue(backgroundImageSynchronousLoading);
2886 bgMap[ImageVisualProperty.SynchronousLoading] = temp;
2893 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2894 [EditorBrowsable(EditorBrowsableState.Never)]
2895 public Vector2 UpdateSizeHint
2899 return (Vector2)GetValue(UpdateSizeHintProperty);
2903 SetValue(UpdateSizeHintProperty, value);
2904 NotifyPropertyChanged();
2909 /// Enable/Disable ControlState propagation for children.
2910 /// It is false by default.
2911 /// If the View needs to share ControlState with descendants, please set it true.
2912 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2914 [EditorBrowsable(EditorBrowsableState.Never)]
2915 public bool EnableControlStatePropagation
2919 return (bool)GetValue(EnableControlStatePropagationProperty);
2923 SetValue(EnableControlStatePropagationProperty, value);
2924 NotifyPropertyChanged();
2928 private bool InternalEnableControlStatePropagation
2930 get => themeData?.ControlStatePropagation ?? false;
2933 if (InternalEnableControlStatePropagation == value) return;
2935 if (themeData == null) themeData = new ThemeData();
2937 themeData.ControlStatePropagation = value;
2939 foreach (View child in Children)
2941 child.EnableControlStatePropagation = value;
2947 /// By default, it is false in View, true in Control.
2948 /// Note that if the value is true, the View will be a touch receptor.
2950 [EditorBrowsable(EditorBrowsableState.Never)]
2951 public bool EnableControlState
2955 return (bool)GetValue(EnableControlStateProperty);
2959 SetValue(EnableControlStateProperty, value);
2964 /// Whether the actor grab all touches even if touch leaves its boundary.
2966 /// <returns>true, if it grab all touch after start</returns>
2967 [EditorBrowsable(EditorBrowsableState.Never)]
2968 public bool GrabTouchAfterLeave
2972 return (bool)GetValue(GrabTouchAfterLeaveProperty);
2976 SetValue(GrabTouchAfterLeaveProperty, value);
2980 private bool InternalGrabTouchAfterLeave
2985 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2986 pValue.Get(out temp);
2992 var temp = new Tizen.NUI.PropertyValue(value);
2993 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2995 NotifyPropertyChanged();
3000 /// Determines which blend equation will be used to render renderers of this actor.
3002 /// <returns>blend equation enum currently assigned</returns>
3003 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
3004 [EditorBrowsable(EditorBrowsableState.Never)]
3005 public BlendEquationType BlendEquation
3009 return (BlendEquationType)GetValue(BlendEquationProperty);
3013 SetValue(BlendEquationProperty, value);
3017 private BlendEquationType InternalBlendEquation
3022 var pValue = GetProperty(View.Property.BlendEquation);
3023 pValue.Get(out temp);
3025 return (BlendEquationType)temp;
3029 var temp = new Tizen.NUI.PropertyValue((int)value);
3030 SetProperty(View.Property.BlendEquation, temp);
3032 NotifyPropertyChanged();
3037 /// If the value is true, the View will change its style as the theme changes.
3038 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
3040 /// <since_tizen> 9 </since_tizen>
3041 public bool ThemeChangeSensitive
3043 get => (bool)GetValue(ThemeChangeSensitiveProperty);
3044 set => SetValue(ThemeChangeSensitiveProperty, value);
3048 /// Create Style, it is abstract function and must be override.
3050 [EditorBrowsable(EditorBrowsableState.Never)]
3051 protected virtual ViewStyle CreateViewStyle()
3053 return new ViewStyle();
3057 /// Called after the View's ControlStates changed.
3059 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
3060 [EditorBrowsable(EditorBrowsableState.Never)]
3061 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
3067 [EditorBrowsable(EditorBrowsableState.Never)]
3068 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
3070 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
3071 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
3075 /// Apply style instance to the view.
3076 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
3078 /// <since_tizen> 9 </since_tizen>
3079 public virtual void ApplyStyle(ViewStyle viewStyle)
3081 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
3083 if (themeData == null) themeData = new ThemeData();
3085 themeData.viewStyle = viewStyle;
3087 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
3093 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
3095 if (bindablePropertyOfView == null)
3100 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
3101 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
3103 foreach (var sourceProperty in dirtyStyleProperties)
3105 var sourceValue = viewStyle.GetValue(sourceProperty);
3107 if (sourceValue == null)
3112 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
3114 if (destinationProperty != null)
3116 SetValue(destinationProperty, sourceValue);
3122 /// Get whether the View is culled or not.
3123 /// True means that the View is out of the view frustum.
3126 /// Hidden-API (Inhouse-API).
3128 [EditorBrowsable(EditorBrowsableState.Never)]
3134 var pValue = GetProperty(View.Property.Culled);
3135 pValue.Get(out temp);
3142 /// Set or Get TransitionOptions for the page transition.
3143 /// This property is used to define how this view will be transitioned during Page switching.
3145 /// <since_tizen> 9 </since_tizen>
3146 public TransitionOptions TransitionOptions
3150 return GetValue(TransitionOptionsProperty) as TransitionOptions;
3154 SetValue(TransitionOptionsProperty, value);
3155 NotifyPropertyChanged();
3159 private TransitionOptions InternalTransitionOptions
3163 transitionOptions = value;
3167 return transitionOptions;
3172 /// Gets or sets the status of whether the view should emit key event signals.
3173 /// If a View's DispatchKeyEvents is set to false, then it's children will not emit a key event signal either.
3175 [EditorBrowsable(EditorBrowsableState.Never)]
3176 public bool DispatchKeyEvents
3180 return (bool)GetValue(DispatchKeyEventsProperty);
3184 SetValue(DispatchKeyEventsProperty, value);
3185 NotifyPropertyChanged();