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;
72 RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
73 RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
74 RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
75 RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);
77 RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
78 RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
79 RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
80 RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);
82 RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
83 RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
84 RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
85 RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
89 /// Creates a new instance of a view.
91 /// <since_tizen> 3 </since_tizen>
92 public View() : this(Interop.View.New(), true)
94 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
98 [EditorBrowsable(EditorBrowsableState.Never)]
99 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
104 /// Create a new instance of a View with setting the status of shown or hidden.
106 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
107 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
108 [EditorBrowsable(EditorBrowsableState.Never)]
109 public View(bool shown) : this(Interop.View.New(), true)
111 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
115 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
126 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
128 InitializeStyle(viewStyle);
131 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
135 PositionUsesPivotPoint = false;
138 onWindowSendEventCallback = SendViewAddedEventToWindow;
139 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
140 signal?.Connect(onWindowSendEventCallback);
148 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
150 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159 /// The event that is triggered when the View's ControlState is changed.
161 [EditorBrowsable(EditorBrowsableState.Never)]
162 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
164 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
168 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
170 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
171 [EditorBrowsable(EditorBrowsableState.Never)]
172 public bool LayoutSet
181 /// Flag to allow Layouting to be disabled for Views.
182 /// Once a View has a Layout set then any children added to Views from then on will receive
183 /// automatic Layouts.
185 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
186 [EditorBrowsable(EditorBrowsableState.Never)]
187 public static bool LayoutingDisabled { get; set; } = true;
190 /// Deprecate. Please do not use this.
191 /// The style instance applied to this view.
192 /// Note that please do not modify the ViewStyle.
193 /// Modifying ViewStyle will affect other views with same ViewStyle.
195 [EditorBrowsable(EditorBrowsableState.Never)]
196 protected ViewStyle ViewStyle
200 if (themeData == null) themeData = new ThemeData();
202 if (themeData.viewStyle == null)
204 ApplyStyle(CreateViewStyle());
206 return themeData.viewStyle;
211 /// Get/Set the control state.
212 /// Note that the ControlState only available for the classes derived from Control.
213 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
214 /// please set <see cref="EnableControlState"/> to true.
216 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
217 [EditorBrowsable(EditorBrowsableState.Never)]
218 public ControlState ControlState
222 return themeData == null ? ControlState.Normal : themeData.controlStates;
226 if (ControlState == value)
231 var prevState = ControlState;
233 if (themeData == null) themeData = new ThemeData();
234 themeData.controlStates = value;
236 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
238 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
240 if (themeData.ControlStatePropagation)
242 foreach (View child in Children)
244 child.ControlState = value;
248 OnControlStateChanged(changeInfo);
250 ControlStateChangedEvent?.Invoke(this, changeInfo);
255 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
257 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
258 [EditorBrowsable(EditorBrowsableState.Never)]
259 public bool ExcludeLayouting
263 return (bool)GetValue(ExcludeLayoutingProperty);
267 SetValue(ExcludeLayoutingProperty, value);
268 NotifyPropertyChanged();
272 private bool InternalExcludeLayouting
276 return excludeLayouting;
280 excludeLayouting = value;
281 if (Layout != null && Layout.SetPositionByLayout == value)
283 Layout.SetPositionByLayout = !value;
284 Layout.RequestLayout();
289 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
290 [EditorBrowsable(EditorBrowsableState.Never)]
291 public bool IsResourcesCreated
295 return Application.Current.IsResourcesCreated;
299 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
300 [EditorBrowsable(EditorBrowsableState.Never)]
301 public ResourceDictionary XamlResources
305 return Application.Current.XamlResources;
309 Application.Current.XamlResources = value;
314 /// The StyleName, type string.
315 /// The value indicates DALi style name defined in json theme file.
317 /// <since_tizen> 3 </since_tizen>
318 public string StyleName
322 return (string)GetValue(StyleNameProperty);
326 SetValue(StyleNameProperty, value);
327 NotifyPropertyChanged();
332 /// The KeyInputFocus, type bool.
334 [EditorBrowsable(EditorBrowsableState.Never)]
335 public bool KeyInputFocus
339 return (bool)GetValue(KeyInputFocusProperty);
343 SetValue(KeyInputFocusProperty, value);
344 NotifyPropertyChanged();
349 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
353 /// The property cascade chaining set is not recommended.
356 /// Animatable - This property can be animated using <c>Animation</c> class.
358 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
363 /// This way is recommended for setting the property
365 /// var view = new View();
366 /// view.BackgroundColor = new Color(0.5f, 0.1f, 0, 1);
368 /// This way to set the property is prohibited
370 /// view.BackgroundColor.R = 0.5f; //This does not guarantee a proper operation
373 /// <since_tizen> 3 </since_tizen>
374 public Color BackgroundColor
378 return (Color)GetValue(BackgroundColorProperty);
382 SetValue(BackgroundColorProperty, value);
383 NotifyPropertyChanged();
388 /// The mutually exclusive with "backgroundColor" and "background" type Map.
390 /// <since_tizen> 3 </since_tizen>
391 public string BackgroundImage
395 return (string)GetValue(BackgroundImageProperty);
399 SetValue(BackgroundImageProperty, value);
400 NotifyPropertyChanged();
405 /// Get or set the border of background image.
407 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
408 [EditorBrowsable(EditorBrowsableState.Never)]
409 public Rectangle BackgroundImageBorder
413 return (Rectangle)GetValue(BackgroundImageBorderProperty);
417 SetValue(BackgroundImageBorderProperty, value);
418 NotifyPropertyChanged();
423 /// The background of view.
425 /// <since_tizen> 3 </since_tizen>
426 public Tizen.NUI.PropertyMap Background
430 return (PropertyMap)GetValue(BackgroundProperty);
434 SetValue(BackgroundProperty, value);
435 NotifyPropertyChanged();
440 /// Describes a shadow as an image for a View.
441 /// It is null by default.
444 /// Getter returns copied instance of current shadow.
447 /// The mutually exclusive with "BoxShadow".
451 /// Animatable - This property can be animated using <c>Animation</c> class.
452 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
454 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
456 /// Animatable sub-property : Offset.
459 [EditorBrowsable(EditorBrowsableState.Never)]
460 public ImageShadow ImageShadow
464 return (ImageShadow)GetValue(ImageShadowProperty);
468 SetValue(ImageShadowProperty, value);
469 NotifyPropertyChanged();
474 /// Describes a box shaped shadow drawing for a View.
475 /// It is null by default.
478 /// The mutually exclusive with "ImageShadow".
482 /// Animatable - This property can be animated using <c>Animation</c> class.
483 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
485 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
487 /// Animatable sub-property : Offset, Color, BlurRadius.
490 /// <since_tizen> 9 </since_tizen>
491 public Shadow BoxShadow
495 return (Shadow)GetValue(BoxShadowProperty);
499 SetValue(BoxShadowProperty, value);
500 NotifyPropertyChanged();
505 /// The radius for the rounded corners of the View.
506 /// This will rounds background and shadow edges.
507 /// 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).
508 /// Each radius will clamp internally to the half of smaller of the view's width or height.
509 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
513 /// Animatable - This property can be animated using <c>Animation</c> class.
515 /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10));
519 /// <since_tizen> 9 </since_tizen>
520 public Vector4 CornerRadius
524 return (Vector4)GetValue(CornerRadiusProperty);
528 SetValue(CornerRadiusProperty, value);
529 NotifyPropertyChanged();
534 /// Whether the CornerRadius property value is relative (percentage [0.0f to 0.5f] of the view size) or absolute (in world units).
535 /// It is absolute by default.
536 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
538 /// <since_tizen> 9 </since_tizen>
539 public VisualTransformPolicyType CornerRadiusPolicy
541 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
542 set => SetValue(CornerRadiusPolicyProperty, value);
546 /// The width for the borderline of the View.
550 /// Animatable - This property can be animated using <c>Animation</c> class.
552 /// animation.AnimateTo(view, "BorderlineWidth", 100.0f);
555 /// Note that, an image background may not have borderline if it uses the Border property.
557 /// <since_tizen> 9 </since_tizen>
558 public float BorderlineWidth
562 return (float)GetValue(BorderlineWidthProperty);
566 SetValue(BorderlineWidthProperty, value);
567 NotifyPropertyChanged();
572 /// The color for the borderline of the View.
573 /// It is Color.Black by default.
577 /// Animatable - This property can be animated using <c>Animation</c> class.
579 /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a));
583 /// <since_tizen> 9 </since_tizen>
584 public Color BorderlineColor
588 return (Color)GetValue(BorderlineColorProperty);
592 SetValue(BorderlineColorProperty, value);
593 NotifyPropertyChanged();
598 /// The Relative offset for the borderline of the View.
599 /// Recommended range : [-1.0f to 1.0f].
600 /// If -1.0f, draw borderline inside of the View.
601 /// If 1.0f, draw borderline outside of the View.
602 /// If 0.0f, draw borderline half inside and half outside.
603 /// It is 0.0f by default.
607 /// Animatable - This property can be animated using <c>Animation</c> class.
609 /// animation.AnimateTo(view, "BorderlineOffset", -1.0f);
613 /// <since_tizen> 9 </since_tizen>
614 public float BorderlineOffset
618 return (float)GetValue(BorderlineOffsetProperty);
622 SetValue(BorderlineOffsetProperty, value);
623 NotifyPropertyChanged();
628 /// The current state of the view.
630 /// <since_tizen> 3 </since_tizen>
635 return (States)GetValue(StateProperty);
639 SetValue(StateProperty, value);
640 NotifyPropertyChanged();
645 /// The current sub state of the view.
647 /// <since_tizen> 3 </since_tizen>
648 public States SubState
652 return (States)GetValue(SubStateProperty);
656 SetValue(SubStateProperty, value);
657 NotifyPropertyChanged();
662 /// Displays a tooltip
664 /// <since_tizen> 3 </since_tizen>
665 public Tizen.NUI.PropertyMap Tooltip
669 return (PropertyMap)GetValue(TooltipProperty);
673 SetValue(TooltipProperty, value);
674 NotifyPropertyChanged();
679 /// Displays a tooltip as a text.
681 /// <since_tizen> 3 </since_tizen>
682 public string TooltipText
686 return GetValue(TooltipTextProperty) as string;
690 SetValue(TooltipTextProperty, value);
694 private string InternalTooltipText
698 using (var propertyValue = GetProperty(Property.TOOLTIP))
700 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
702 return retrivedValue;
704 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
705 return "error to get TooltipText";
710 var temp = new Tizen.NUI.PropertyValue(value);
711 SetProperty(View.Property.TOOLTIP, temp);
713 NotifyPropertyChanged();
718 /// The Child property of FlexContainer.<br />
719 /// The proportion of the free space in the container, the flex item will receive.<br />
720 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
722 /// <since_tizen> 3 </since_tizen>
723 [Obsolete("Deprecated in API8, will be removed in API10.")]
728 return (float)GetValue(FlexProperty);
732 SetValue(FlexProperty, value);
733 NotifyPropertyChanged();
738 /// The Child property of FlexContainer.<br />
739 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
741 /// <since_tizen> 3 </since_tizen>
742 [Obsolete("Deprecated in API8, will be removed in API10.")]
747 return (int)GetValue(AlignSelfProperty);
751 SetValue(AlignSelfProperty, value);
752 NotifyPropertyChanged();
757 /// The Child property of FlexContainer.<br />
758 /// The space around the flex item.<br />
761 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
763 /// <since_tizen> 3 </since_tizen>
764 [Obsolete("Deprecated in API8, will be removed in API10.")]
765 public Vector4 FlexMargin
769 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
770 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
774 SetValue(FlexMarginProperty, value);
775 NotifyPropertyChanged();
780 /// The top-left cell this child occupies, if not set, the first available cell is used.
783 /// The property cascade chaining set is not recommended.
784 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
787 /// This way is recommended for setting the property
789 /// var view = new View();
790 /// view.CellIndex = new Vector2(1, 3);
792 /// This way to set the property is prohibited
794 /// view.CellIndex.X = 1; //This does not guarantee a proper operation
797 /// <since_tizen> 3 </since_tizen>
798 public Vector2 CellIndex
802 return (Vector2)GetValue(CellIndexProperty);
806 SetValue(CellIndexProperty, value);
807 NotifyPropertyChanged();
812 /// The number of rows this child occupies, if not set, the default value is 1.
815 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
817 /// <since_tizen> 3 </since_tizen>
822 return (float)GetValue(RowSpanProperty);
826 SetValue(RowSpanProperty, value);
827 NotifyPropertyChanged();
832 /// The number of columns this child occupies, if not set, the default value is 1.
835 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
837 /// <since_tizen> 3 </since_tizen>
838 public float ColumnSpan
842 return (float)GetValue(ColumnSpanProperty);
846 SetValue(ColumnSpanProperty, value);
847 NotifyPropertyChanged();
852 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
855 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
857 /// <since_tizen> 3 </since_tizen>
858 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
862 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
866 SetValue(CellHorizontalAlignmentProperty, value);
867 NotifyPropertyChanged();
872 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
875 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
877 /// <since_tizen> 3 </since_tizen>
878 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
882 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
886 SetValue(CellVerticalAlignmentProperty, value);
887 NotifyPropertyChanged();
892 /// The left focusable view.<br />
893 /// This will return null if not set.<br />
894 /// This will also return null if the specified left focusable view is not on a window.<br />
896 /// <since_tizen> 3 </since_tizen>
897 public View LeftFocusableView
899 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
902 return (View)GetValue(LeftFocusableViewProperty);
906 SetValue(LeftFocusableViewProperty, value);
907 NotifyPropertyChanged();
912 /// The right focusable view.<br />
913 /// This will return null if not set.<br />
914 /// This will also return null if the specified right focusable view is not on a window.<br />
916 /// <since_tizen> 3 </since_tizen>
917 public View RightFocusableView
919 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
922 return (View)GetValue(RightFocusableViewProperty);
926 SetValue(RightFocusableViewProperty, value);
927 NotifyPropertyChanged();
932 /// The up focusable view.<br />
933 /// This will return null if not set.<br />
934 /// This will also return null if the specified up focusable view is not on a window.<br />
936 /// <since_tizen> 3 </since_tizen>
937 public View UpFocusableView
939 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
942 return (View)GetValue(UpFocusableViewProperty);
946 SetValue(UpFocusableViewProperty, value);
947 NotifyPropertyChanged();
952 /// The down focusable view.<br />
953 /// This will return null if not set.<br />
954 /// This will also return null if the specified down focusable view is not on a window.<br />
956 /// <since_tizen> 3 </since_tizen>
957 public View DownFocusableView
959 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
962 return (View)GetValue(DownFocusableViewProperty);
966 SetValue(DownFocusableViewProperty, value);
967 NotifyPropertyChanged();
972 /// Whether the view should be focusable by keyboard navigation.
974 /// <since_tizen> 3 </since_tizen>
975 public bool Focusable
979 SetValue(FocusableProperty, value);
980 NotifyPropertyChanged();
984 return (bool)GetValue(FocusableProperty);
989 /// 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.
990 /// Note : Default value is true.
992 [EditorBrowsable(EditorBrowsableState.Never)]
993 public bool FocusableChildren
997 SetValue(FocusableChildrenProperty, value);
998 NotifyPropertyChanged();
1002 return (bool)GetValue(FocusableChildrenProperty);
1007 /// Whether this view can focus by touch.
1008 /// If Focusable is false, FocusableInTouch is disabled.
1009 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
1011 [EditorBrowsable(EditorBrowsableState.Never)]
1012 public bool FocusableInTouch
1016 SetValue(FocusableInTouchProperty, value);
1017 NotifyPropertyChanged();
1021 return (bool)GetValue(FocusableInTouchProperty);
1026 /// Retrieves the position of the view.<br />
1027 /// The coordinates are relative to the view's parent.<br />
1029 /// <since_tizen> 3 </since_tizen>
1030 public Position CurrentPosition
1034 return GetCurrentPosition();
1039 /// Sets the size of a view for the width and the height.<br />
1040 /// Geometry can be scaled to fit within this area.<br />
1041 /// This does not interfere with the view's scale factor.<br />
1042 /// The views default depth is the minimum of width and height.<br />
1045 /// The property cascade chaining set is not recommended.
1048 /// This way is recommended for setting the property
1050 /// var view = new View();
1051 /// view.Size2D = new Size2D(100, 200);
1053 /// This way to set the property is prohibited
1055 /// view.Size2D.Width = 100; //This does not guarantee a proper operation
1058 /// <since_tizen> 3 </since_tizen>
1059 public Size2D Size2D
1063 var temp = (Size2D)GetValue(Size2DProperty);
1065 if (this.Layout == null)
1067 if (temp.Width < 0) { temp.Width = 0; }
1068 if (temp.Height < 0) { temp.Height = 0; }
1075 SetValue(Size2DProperty, value);
1077 NotifyPropertyChanged();
1082 /// Retrieves the size of the view.<br />
1083 /// The coordinates are relative to the view's parent.<br />
1085 /// <since_tizen> 3 </since_tizen>
1086 public Size2D CurrentSize
1090 return GetCurrentSize();
1095 /// Retrieves and sets the view's opacity.<br />
1099 /// Animatable - This property can be animated using <c>Animation</c> class.
1101 /// animation.AnimateTo(view, "Opacity", 0.5f);
1105 /// <since_tizen> 3 </since_tizen>
1106 public float Opacity
1110 return (float)GetValue(OpacityProperty);
1114 SetValue(OpacityProperty, value);
1115 NotifyPropertyChanged();
1120 /// Sets the position of the view for X and Y.<br />
1121 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1122 /// If the position inheritance is disabled, sets the world position.<br />
1125 /// The property cascade chaining set is not recommended.
1128 /// This way is recommended for setting the property
1130 /// var view = new View();
1131 /// view.Position2D = new Position2D(100, 200);
1133 /// This way to set the property is prohibited
1135 /// view.Position2D.X = 100; //This does not guarantee a proper operation
1138 /// <since_tizen> 3 </since_tizen>
1139 public Position2D Position2D
1143 return (Position2D)GetValue(Position2DProperty);
1147 SetValue(Position2DProperty, value);
1148 NotifyPropertyChanged();
1153 /// Retrieves the screen position of the view.<br />
1155 /// <since_tizen> 3 </since_tizen>
1156 public Vector2 ScreenPosition
1160 Vector2 temp = new Vector2(0.0f, 0.0f);
1161 var pValue = GetProperty(View.Property.ScreenPosition);
1169 /// Determines whether the pivot point should be used to determine the position of the view.
1170 /// This is false by default.
1172 /// <remarks>If false, then the top-left of the view is used for the position.
1173 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1175 /// <since_tizen> 3 </since_tizen>
1176 public bool PositionUsesPivotPoint
1180 return (bool)GetValue(PositionUsesPivotPointProperty);
1184 SetValue(PositionUsesPivotPointProperty, value);
1185 NotifyPropertyChanged();
1190 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1192 /// <since_tizen> 3 </since_tizen>
1193 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1195 "View view = new View(); " +
1196 "view.PivotPoint = PivotPoint.Center; " +
1197 "view.PositionUsesPivotPoint = true;" +
1198 " Deprecated in API5: Will be removed in API8")]
1199 [EditorBrowsable(EditorBrowsableState.Never)]
1200 public bool PositionUsesAnchorPoint
1204 return (bool)GetValue(PositionUsesAnchorPointProperty);
1208 SetValue(PositionUsesAnchorPointProperty, value);
1212 private bool InternalPositionUsesAnchorPoint
1217 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1218 pValue.Get(out temp);
1224 var temp = new Tizen.NUI.PropertyValue(value);
1225 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1227 NotifyPropertyChanged();
1232 /// Queries whether the view is connected to the stage.<br />
1233 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1235 /// <since_tizen> 3 </since_tizen>
1236 public bool IsOnWindow
1245 /// Gets the depth in the hierarchy for the view.
1247 /// <since_tizen> 3 </since_tizen>
1248 public int HierarchyDepth
1252 return GetHierarchyDepth();
1257 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1260 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1261 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1262 /// The values set by this property will likely change.
1264 /// <since_tizen> 3 </since_tizen>
1265 public int SiblingOrder
1269 return (int)GetValue(SiblingOrderProperty);
1273 SetValue(SiblingOrderProperty, value);
1275 Layout?.ChangeLayoutSiblingOrder(value);
1277 NotifyPropertyChanged();
1282 /// Returns the natural size of the view.
1285 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1287 /// <since_tizen> 5 </since_tizen>
1288 public Vector3 NaturalSize
1292 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1293 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1299 /// Returns the natural size (Size2D) of the view.
1302 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1304 /// <since_tizen> 4 </since_tizen>
1305 public Size2D NaturalSize2D
1309 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1310 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1312 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1319 /// Gets or sets the origin of a view within its parent's area.<br />
1320 /// 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 />
1321 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1322 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1324 /// <pre>The view has been initialized.</pre>
1325 /// <since_tizen> 3 </since_tizen>
1326 public Position ParentOrigin
1330 Position tmp = (Position)GetValue(ParentOriginProperty);
1331 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1335 SetValue(ParentOriginProperty, value);
1336 NotifyPropertyChanged();
1341 /// Gets or sets the anchor-point of a view.<br />
1342 /// 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 />
1343 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1344 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1345 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1346 /// <pre>The view has been initialized.</pre>
1349 /// The property cascade chaining set is not recommended.
1352 /// This way is recommended for setting the property
1354 /// var view = new View();
1355 /// view.PivotPoint = PivotPoint.Center;
1357 /// This way to set the property is prohibited
1359 /// view.PivotPoint.X = 0.5f; //This does not guarantee a proper operation
1362 /// <since_tizen> 3 </since_tizen>
1363 public Position PivotPoint
1367 return (Position)GetValue(PivotPointProperty);
1371 SetValue(PivotPointProperty, value);
1372 NotifyPropertyChanged();
1377 /// Gets or sets the size width of the view.
1381 /// Animatable - This property can be animated using <c>Animation</c> class.
1383 /// animation.AnimateTo(view, "SizeWidth", 500.0f);
1387 /// <since_tizen> 3 </since_tizen>
1388 public float SizeWidth
1392 return (float)GetValue(SizeWidthProperty);
1396 SetValue(SizeWidthProperty, value);
1397 NotifyPropertyChanged();
1402 /// Gets or sets the size height of the view.
1406 /// Animatable - This property can be animated using <c>Animation</c> class.
1409 /// animation.AnimateTo(view, "SizeHeight", 500.0f);
1412 /// <since_tizen> 3 </since_tizen>
1413 public float SizeHeight
1417 return (float)GetValue(SizeHeightProperty);
1421 SetValue(SizeHeightProperty, value);
1422 NotifyPropertyChanged();
1427 /// Gets or sets the position of the view.<br />
1428 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1429 /// If the position inheritance is disabled, sets the world position.<br />
1433 /// Animatable - This property can be animated using <c>Animation</c> class.
1435 /// animation.AnimateTo(view, "Position", new Position(50, 0));
1438 /// The property cascade chaining set is not recommended.
1441 /// This way is recommended for setting the property
1443 /// var view = new View();
1444 /// view.Position = new Position(100, 200.5f, 0);
1446 /// This way to set the property is prohibited
1448 /// view.Position.Y = 200.5f; //This does not guarantee a proper operation
1451 /// <since_tizen> 3 </since_tizen>
1452 public Position Position
1456 return (Position)GetValue(PositionProperty);
1460 SetValue(PositionProperty, value);
1461 NotifyPropertyChanged();
1466 /// Gets or sets the position X of the view.
1470 /// Animatable - This property can be animated using <c>Animation</c> class.
1472 /// animation.AnimateTo(view, "PositionX", 50.0f);
1476 /// <since_tizen> 3 </since_tizen>
1477 public float PositionX
1481 return (float)GetValue(PositionXProperty);
1485 SetValue(PositionXProperty, value);
1486 NotifyPropertyChanged();
1491 /// Gets or sets the position Y of the view.
1495 /// Animatable - This property can be animated using <c>Animation</c> class.
1497 /// animation.AnimateTo(view, "PositionY", 50.0f);
1501 /// <since_tizen> 3 </since_tizen>
1502 public float PositionY
1506 return (float)GetValue(PositionYProperty);
1510 SetValue(PositionYProperty, value);
1511 NotifyPropertyChanged();
1516 /// Gets or sets the position Z of the view.
1520 /// Animatable - This property can be animated using <c>Animation</c> class.
1522 /// animation.AnimateTo(view, "PositionZ", 50.0f);
1526 /// <since_tizen> 3 </since_tizen>
1527 public float PositionZ
1531 return (float)GetValue(PositionZProperty);
1535 SetValue(PositionZProperty, value);
1536 NotifyPropertyChanged();
1541 /// Gets or sets the world position of the view.
1543 /// <since_tizen> 3 </since_tizen>
1544 public Vector3 WorldPosition
1548 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1549 var pValue = GetProperty(View.Property.WorldPosition);
1557 /// Gets or sets the orientation of the view.<br />
1558 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1562 /// This is an asynchronous method.
1565 /// Animatable - This property can be animated using <c>Animation</c> class.
1567 /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis));
1571 /// <since_tizen> 3 </since_tizen>
1572 public Rotation Orientation
1576 return (Rotation)GetValue(OrientationProperty);
1580 SetValue(OrientationProperty, value);
1581 NotifyPropertyChanged();
1586 /// Gets or sets the world orientation of the view.<br />
1588 /// <since_tizen> 3 </since_tizen>
1589 public Rotation WorldOrientation
1593 Rotation temp = new Rotation();
1594 var pValue = GetProperty(View.Property.WorldOrientation);
1602 /// Gets or sets the scale factor applied to the view.<br />
1606 /// Animatable - This property can be animated using <c>Animation</c> class.
1608 /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f));
1611 /// The property cascade chaining set is not recommended.
1614 /// This way is recommended for setting the property
1616 /// var view = new View();
1617 /// view.Scale = new Vector3(1.5f, 2.0f, 1.0f);
1619 /// This way to set the property is prohibited
1621 /// view.Scale.Width = 1.5f; //This does not guarantee a proper operation
1624 /// <since_tizen> 3 </since_tizen>
1625 public Vector3 Scale
1629 return (Vector3)GetValue(ScaleProperty);
1633 SetValue(ScaleProperty, value);
1634 NotifyPropertyChanged();
1639 /// Gets or sets the scale X factor applied to the view.
1643 /// Animatable - This property can be animated using <c>Animation</c> class.
1645 /// animation.AnimateTo(view, "ScaleX", 1.5f);
1649 /// <since_tizen> 3 </since_tizen>
1654 return (float)GetValue(ScaleXProperty);
1658 SetValue(ScaleXProperty, value);
1659 NotifyPropertyChanged();
1664 /// Gets or sets the scale Y factor applied to the view.
1668 /// Animatable - This property can be animated using <c>Animation</c> class.
1670 /// animation.AnimateTo(view, "ScaleY", 1.5f);
1674 /// <since_tizen> 3 </since_tizen>
1679 return (float)GetValue(ScaleYProperty);
1683 SetValue(ScaleYProperty, value);
1684 NotifyPropertyChanged();
1689 /// Gets or sets the scale Z factor applied to the view.
1693 /// Animatable - This property can be animated using <c>Animation</c> class.
1695 /// animation.AnimateTo(view, "ScaleZ", 1.5f);
1699 /// <since_tizen> 3 </since_tizen>
1704 return (float)GetValue(ScaleZProperty);
1708 SetValue(ScaleZProperty, value);
1709 NotifyPropertyChanged();
1714 /// Gets the world scale of the view.
1716 /// <since_tizen> 3 </since_tizen>
1717 public Vector3 WorldScale
1721 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1722 var pValue = GetProperty(View.Property.WorldScale);
1730 /// Retrieves the visibility flag of the view.
1734 /// If the view is not visible, then the view and its children will not be rendered.
1735 /// 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.
1738 /// Animatable - This property can be animated using <c>Animation</c> class.
1740 /// animation.AnimateTo(view, "Visibility", false);
1744 /// <since_tizen> 3 </since_tizen>
1745 public bool Visibility
1750 var pValue = GetProperty(View.Property.VISIBLE);
1751 pValue.Get(out temp);
1758 /// Gets the view's world color.
1760 /// <since_tizen> 3 </since_tizen>
1761 public Vector4 WorldColor
1765 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1766 var pValue = GetProperty(View.Property.WorldColor);
1774 /// Gets or sets the view's name.
1776 /// <since_tizen> 3 </since_tizen>
1781 return (string)GetValue(NameProperty);
1785 SetValue(NameProperty, value);
1786 NotifyPropertyChanged();
1791 /// Get the number of children held by the view.
1793 /// <since_tizen> 3 </since_tizen>
1794 public new uint ChildCount
1798 return Convert.ToUInt32(Children.Count);
1803 /// Gets the view's ID.
1806 /// <since_tizen> 3 </since_tizen>
1816 /// Gets or sets the status of whether the view should emit touch or hover signals.
1817 /// If a View is made insensitive, then the View and its children are not hittable.
1819 /// <since_tizen> 3 </since_tizen>
1820 public bool Sensitive
1824 return (bool)GetValue(SensitiveProperty);
1828 SetValue(SensitiveProperty, value);
1829 NotifyPropertyChanged();
1834 /// 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.
1836 /// <since_tizen> 3 </since_tizen>
1837 public bool LeaveRequired
1841 return (bool)GetValue(LeaveRequiredProperty);
1845 SetValue(LeaveRequiredProperty, value);
1846 NotifyPropertyChanged();
1851 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1853 /// <since_tizen> 3 </since_tizen>
1854 public bool InheritOrientation
1858 return (bool)GetValue(InheritOrientationProperty);
1862 SetValue(InheritOrientationProperty, value);
1863 NotifyPropertyChanged();
1868 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1870 /// <since_tizen> 3 </since_tizen>
1871 public bool InheritScale
1875 return (bool)GetValue(InheritScaleProperty);
1879 SetValue(InheritScaleProperty, value);
1880 NotifyPropertyChanged();
1885 /// Gets or sets the status of how the view and its children should be drawn.<br />
1886 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1887 /// 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 />
1888 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1889 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1890 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1892 /// <since_tizen> 3 </since_tizen>
1893 public DrawModeType DrawMode
1897 return (DrawModeType)GetValue(DrawModeProperty);
1901 SetValue(DrawModeProperty, value);
1902 NotifyPropertyChanged();
1907 /// Gets or sets the relative to parent size factor of the view.<br />
1908 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1909 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1912 /// The property cascade chaining set is not recommended.
1915 /// This way is recommended for setting the property
1917 /// var text = new TextField();
1918 /// text.SizeModeFactor = new Vector3(1.0f, 0.45f, 1.0f);
1920 /// This way to set the property is prohibited
1922 /// text.SizeModeFactor.Width = 1.0f; //This does not guarantee a proper operation
1925 /// <since_tizen> 3 </since_tizen>
1926 public Vector3 SizeModeFactor
1930 return (Vector3)GetValue(SizeModeFactorProperty);
1934 SetValue(SizeModeFactorProperty, value);
1935 NotifyPropertyChanged();
1940 /// Gets or sets the width resize policy to be used.
1942 /// <since_tizen> 3 </since_tizen>
1943 public ResizePolicyType WidthResizePolicy
1947 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1951 SetValue(WidthResizePolicyProperty, value);
1952 NotifyPropertyChanged();
1957 /// Gets or sets the height resize policy to be used.
1959 /// <since_tizen> 3 </since_tizen>
1960 public ResizePolicyType HeightResizePolicy
1964 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1968 SetValue(HeightResizePolicyProperty, value);
1969 NotifyPropertyChanged();
1974 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1975 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1977 /// <since_tizen> 3 </since_tizen>
1978 public SizeScalePolicyType SizeScalePolicy
1982 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1986 SetValue(SizeScalePolicyProperty, value);
1987 NotifyPropertyChanged();
1992 /// Gets or sets the status of whether the width size is dependent on the height size.
1994 /// <since_tizen> 3 </since_tizen>
1995 public bool WidthForHeight
1999 return (bool)GetValue(WidthForHeightProperty);
2003 SetValue(WidthForHeightProperty, value);
2004 NotifyPropertyChanged();
2009 /// Gets or sets the status of whether the height size is dependent on the width size.
2011 /// <since_tizen> 3 </since_tizen>
2012 public bool HeightForWidth
2016 return (bool)GetValue(HeightForWidthProperty);
2020 SetValue(HeightForWidthProperty, value);
2021 NotifyPropertyChanged();
2026 /// Gets or sets the padding for use in layout.
2029 /// The property cascade chaining set is not recommended.
2032 /// This way is recommended for setting the property
2034 /// var view = new View();
2035 /// view.Padding = new Extents(5, 5, 5, 5);
2037 /// This way to set the property is prohibited
2039 /// view.Padding.Start = 5; //This does not guarantee a proper operation
2042 /// <since_tizen> 5 </since_tizen>
2043 public Extents Padding
2047 // If View has a Layout then padding in stored in the base Layout class
2050 return Layout.Padding;
2054 return (Extents)GetValue(PaddingProperty);
2056 // Two return points to prevent creating a zeroed Extent native object before assignment
2060 Extents padding = value;
2063 // Layout set so store Padding in LayoutItem instead of in View.
2064 // If View stores the Padding value then Legacy Size Negotiation will overwrite
2065 // the position and sizes measure in the Layouting.
2066 Layout.Padding = value;
2067 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2068 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2069 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
2071 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
2075 SetValue(PaddingProperty, padding);
2076 NotifyPropertyChanged();
2081 /// Gets or sets the minimum size the view can be assigned in size negotiation.
2083 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2085 /// The property cascade chaining set is not recommended.
2088 /// This way is recommended for setting the property
2090 /// var view = new View();
2091 /// view.MinimumSize = new Size2D(100, 200);
2093 /// This way to set the property is prohibited
2095 /// view.MinimumSize.Width = 100; //This does not guarantee a proper operation
2098 /// <since_tizen> 3 </since_tizen>
2099 public Size2D MinimumSize
2103 return (Size2D)GetValue(MinimumSizeProperty);
2109 throw new ArgumentNullException(nameof(value));
2113 // Note: it only works if minimum size is >= than natural size.
2114 // To force the size it should be done through the width&height spec or Size2D.
2115 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
2116 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
2117 layout.RequestLayout();
2119 SetValue(MinimumSizeProperty, value);
2120 NotifyPropertyChanged();
2125 /// Gets or sets the maximum size the view can be assigned in size negotiation.
2128 /// This way is recommended for setting the property
2130 /// var view = new View();
2131 /// view.MaximumSize = new Size2D(100, 200);
2133 /// This way to set the property is prohibited
2135 /// view.MaximumSize.Height = 200; //This does not guarantee a proper operation
2138 /// <since_tizen> 3 </since_tizen>
2139 public Size2D MaximumSize
2143 return (Size2D)GetValue(MaximumSizeProperty);
2147 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
2148 // MATCH_PARENT spec + parent container size can be used to limit
2151 layout.RequestLayout();
2153 SetValue(MaximumSizeProperty, value);
2154 NotifyPropertyChanged();
2159 /// Gets or sets whether a child view inherits it's parent's position.<br />
2160 /// Default is to inherit.<br />
2161 /// 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 />
2163 /// <since_tizen> 3 </since_tizen>
2164 public bool InheritPosition
2168 return (bool)GetValue(InheritPositionProperty);
2172 SetValue(InheritPositionProperty, value);
2173 NotifyPropertyChanged();
2178 /// Gets or sets the clipping behavior (mode) of it's children.
2180 /// <since_tizen> 3 </since_tizen>
2181 public ClippingModeType ClippingMode
2185 return (ClippingModeType)GetValue(ClippingModeProperty);
2189 SetValue(ClippingModeProperty, value);
2190 NotifyPropertyChanged();
2195 /// Gets the number of renderers held by the view.
2197 /// <since_tizen> 3 </since_tizen>
2198 public uint RendererCount
2202 return GetRendererCount();
2207 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2210 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2212 /// <since_tizen> 3 </since_tizen>
2213 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2215 "View view = new View(); " +
2216 "view.PivotPoint = PivotPoint.Center; " +
2217 "view.PositionUsesPivotPoint = true;")]
2218 [EditorBrowsable(EditorBrowsableState.Never)]
2219 public Position AnchorPoint
2223 return GetValue(AnchorPointProperty) as Position;
2227 SetValue(AnchorPointProperty, value);
2231 private Position InternalAnchorPoint
2235 Position temp = new Position(0.0f, 0.0f, 0.0f);
2236 var pValue = GetProperty(View.Property.AnchorPoint);
2239 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2245 var temp = new Tizen.NUI.PropertyValue(value);
2246 SetProperty(View.Property.AnchorPoint, temp);
2248 NotifyPropertyChanged();
2253 /// Sets the size of a view for the width, the height and the depth.<br />
2254 /// Geometry can be scaled to fit within this area.<br />
2255 /// This does not interfere with the view's scale factor.<br />
2256 /// The views default depth is the minimum of width and height.<br />
2260 /// Animatable - This property can be animated using <c>Animation</c> class.
2262 /// animation.AnimateTo(view, "Size", new Size(100, 100));
2265 /// The property cascade chaining set is not recommended.
2268 /// This way is recommended for setting the property
2270 /// var view = new View();
2271 /// view.Size = new Size(100.5f, 200, 0);
2273 /// This way to set the property is prohibited
2275 /// view.Size.Width = 100.5f; //This does not guarantee a proper operation
2278 /// <since_tizen> 5 </since_tizen>
2283 return (Size)GetValue(SizeProperty);
2287 SetValue(SizeProperty, value);
2288 NotifyPropertyChanged();
2293 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2295 /// <since_tizen> 3 </since_tizen>
2296 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2298 "Container parent = view.GetParent(); " +
2299 "View view = parent as View;")]
2300 [EditorBrowsable(EditorBrowsableState.Never)]
2301 public new View Parent
2306 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2307 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2308 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2310 if (basehandle is Layer layer)
2312 ret = new View(Layer.getCPtr(layer).Handle, false);
2313 NUILog.Error("This Parent property is deprecated, should do not be used");
2317 ret = basehandle as View;
2320 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2321 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2323 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2329 /// Gets/Sets whether inherit parent's the layout Direction.
2331 /// <since_tizen> 4 </since_tizen>
2332 public bool InheritLayoutDirection
2336 return (bool)GetValue(InheritLayoutDirectionProperty);
2340 SetValue(InheritLayoutDirectionProperty, value);
2341 NotifyPropertyChanged();
2346 /// Gets/Sets the layout Direction.
2348 /// <since_tizen> 4 </since_tizen>
2349 public ViewLayoutDirectionType LayoutDirection
2353 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2357 SetValue(LayoutDirectionProperty, value);
2358 NotifyPropertyChanged();
2359 layout?.RequestLayout();
2364 /// Gets or sets the Margin for use in layout.
2367 /// Margin property is supported by Layout algorithms and containers.
2368 /// Please Set Layout if you want to use Margin property.
2369 /// The property cascade chaining set is not recommended.
2372 /// This way is recommended for setting the property
2374 /// var view = new View();
2375 /// view.Margin = new Extents(10, 5, 15, 20);
2377 /// This way to set the property is prohibited
2379 /// view.Margin.Top = 15; //This does not guarantee a proper operation
2382 /// <since_tizen> 4 </since_tizen>
2383 public Extents Margin
2387 // If View has a Layout then margin is stored in Layout.
2390 return Layout.Margin;
2394 // If Layout not set then return margin stored in View.
2395 return (Extents)GetValue(MarginProperty);
2397 // Two return points to prevent creating a zeroed Extent native object before assignment
2403 // Layout set so store Margin in LayoutItem instead of View.
2404 // If View stores the Margin too then the Legacy Size Negotiation will
2405 // overwrite the position and size values measured in the Layouting.
2406 Layout.Margin = value;
2407 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2408 layout?.RequestLayout();
2412 SetValue(MarginProperty, value);
2414 NotifyPropertyChanged();
2415 layout?.RequestLayout();
2420 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2424 /// // matchParentView matches its size to its parent size.
2425 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2426 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2428 /// // wrapContentView wraps its children with their desired size.
2429 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2430 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2432 /// // exactSizeView shows itself with an exact size.
2433 /// exactSizeView.WidthSpecification = 100;
2434 /// exactSizeView.HeightSpecification = 100;
2437 /// <since_tizen> 6 </since_tizen>
2438 [Binding.TypeConverter(typeof(IntDpTypeConverter))]
2439 public int WidthSpecification
2443 return (int)GetValue(WidthSpecificationProperty);
2447 SetValue(WidthSpecificationProperty, value);
2448 NotifyPropertyChanged();
2452 private int InternalWidthSpecification
2460 if (value == widthPolicy)
2463 widthPolicy = value;
2464 if (widthPolicy >= 0)
2466 if (heightPolicy >= 0) // Policy an exact value
2468 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2469 Size2D = new Size2D(widthPolicy, heightPolicy);
2472 layout?.RequestLayout();
2477 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2481 /// // matchParentView matches its size to its parent size.
2482 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2483 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2485 /// // wrapContentView wraps its children with their desired size.
2486 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2487 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2489 /// // exactSizeView shows itself with an exact size.
2490 /// exactSizeView.WidthSpecification = 100;
2491 /// exactSizeView.HeightSpecification = 100;
2494 /// <since_tizen> 6 </since_tizen>
2495 [Binding.TypeConverter(typeof(IntDpTypeConverter))]
2496 public int HeightSpecification
2500 return (int)GetValue(HeightSpecificationProperty);
2504 SetValue(HeightSpecificationProperty, value);
2505 NotifyPropertyChanged();
2509 private int InternalHeightSpecification
2513 return heightPolicy;
2517 if (value == heightPolicy)
2520 heightPolicy = value;
2521 if (heightPolicy >= 0)
2523 if (widthPolicy >= 0) // Policy an exact value
2525 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2526 Size2D = new Size2D(widthPolicy, heightPolicy);
2529 layout?.RequestLayout();
2534 /// Gets the List of transitions for this View.
2536 /// <since_tizen> 6 </since_tizen>
2537 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2541 if (layoutTransitions == null)
2543 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2545 return layoutTransitions;
2550 /// Sets a layout transitions for this View.
2552 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2554 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2556 /// <since_tizen> 6 </since_tizen>
2557 public LayoutTransition LayoutTransition
2561 return GetValue(LayoutTransitionProperty) as LayoutTransition;
2565 SetValue(LayoutTransitionProperty, value);
2566 NotifyPropertyChanged();
2570 private LayoutTransition InternalLayoutTransition
2574 return layoutTransition;
2580 throw new global::System.ArgumentNullException(nameof(value));
2582 if (layoutTransitions == null)
2584 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2587 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2589 AttachTransitionsToChildren(value);
2591 layoutTransition = value;
2596 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2599 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2601 /// <since_tizen> 4 </since_tizen>
2602 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2603 [EditorBrowsable(EditorBrowsableState.Never)]
2604 public Extents PaddingEX
2608 return GetValue(PaddingEXProperty) as Extents;
2612 SetValue(PaddingEXProperty, value);
2616 private Extents InternalPaddingEX
2620 Extents temp = new Extents(0, 0, 0, 0);
2621 var pValue = GetProperty(View.Property.PADDING);
2624 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2630 var temp = new Tizen.NUI.PropertyValue(value);
2631 SetProperty(View.Property.PADDING, temp);
2633 NotifyPropertyChanged();
2634 layout?.RequestLayout();
2638 [EditorBrowsable(EditorBrowsableState.Never)]
2639 public XamlStyle XamlStyle
2643 return (XamlStyle)GetValue(XamlStyleProperty);
2647 SetValue(XamlStyleProperty, value);
2652 /// The Color of View. This is an RGBA value.
2656 /// Animatable - This property can be animated using <c>Animation</c> class.
2658 /// The property cascade chaining set is not recommended.
2661 /// This way is recommended for setting the property
2663 /// var view = new View();
2664 /// view.Color = new Color(0.5f, 0.2f, 0.1f, 0.5f);
2666 /// This way to set the property is prohibited
2668 /// view.Color.A = 0.5f; //This does not guarantee a proper operation
2671 [EditorBrowsable(EditorBrowsableState.Never)]
2676 return (Color)GetValue(ColorProperty);
2680 SetValue(ColorProperty, value);
2681 NotifyPropertyChanged();
2686 /// Set the layout on this View. Replaces any existing Layout.
2689 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2691 /// <since_tizen> 6 </since_tizen>
2692 public LayoutItem Layout
2696 return GetValue(LayoutProperty) as LayoutItem;
2700 SetValue(LayoutProperty, value);
2704 private LayoutItem InternalLayout
2712 // Do nothing if layout provided is already set on this View.
2713 if (value == layout)
2718 LayoutingDisabled = false;
2721 // If new layout being set already has a owner then that owner receives a replacement default layout.
2722 // First check if the layout to be set already has a owner.
2723 if (value?.Owner != null)
2725 // Previous owner of the layout gets a default layout as a replacement.
2726 value.Owner.Layout = new AbsoluteLayout()
2728 // Copy Margin and Padding to replacement LayoutGroup.
2729 Margin = value.Margin,
2730 Padding = value.Padding,
2734 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2735 // View if no replacement. Previously margin and padding values would have been moved from
2736 // the View to the layout.
2737 if (layout != null) // Existing layout
2741 // Existing layout being replaced so copy over margin and padding values.
2742 value.Margin = layout.Margin;
2743 value.Padding = layout.Padding;
2744 value.SetPositionByLayout = !excludeLayouting;
2748 // Layout not being replaced so restore margin and padding to View.
2749 SetValue(MarginProperty, layout.Margin);
2750 SetValue(PaddingProperty, layout.Padding);
2751 NotifyPropertyChanged();
2756 // First Layout to be added to the View hence copy
2758 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2761 Extents margin = Margin;
2762 Extents padding = Padding;
2763 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2765 // If View already has a margin set then store it in Layout instead.
2766 value.Margin = margin;
2767 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2768 NotifyPropertyChanged();
2771 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2773 // If View already has a padding set then store it in Layout instead.
2774 value.Padding = padding;
2776 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2777 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2778 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2780 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2781 NotifyPropertyChanged();
2785 value.SetPositionByLayout = !excludeLayouting;
2789 // Remove existing layout from it's parent layout group.
2792 // Set layout to this view
2798 /// The weight of the View, used to share available space in a layout with siblings.
2800 /// <since_tizen> 6 </since_tizen>
2810 layout?.RequestLayout();
2815 /// Whether to load the BackgroundImage synchronously.
2816 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2817 /// Note: For Normal Quad images only.
2819 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2820 [EditorBrowsable(EditorBrowsableState.Never)]
2821 public bool BackgroundImageSynchronosLoading
2825 return (bool)GetValue(BackgroundImageSynchronosLoadingProperty);
2829 SetValue(BackgroundImageSynchronosLoadingProperty, value);
2830 NotifyPropertyChanged();
2834 private bool InternalBackgroundImageSynchronosLoading
2838 return BackgroundImageSynchronousLoading;
2842 BackgroundImageSynchronousLoading = value;
2847 /// Whether to load the BackgroundImage synchronously.
2848 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2849 /// Note: For Normal Quad images only.
2851 /// This will be public opened in tizen_7.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2852 [EditorBrowsable(EditorBrowsableState.Never)]
2853 public bool BackgroundImageSynchronousLoading
2857 return (bool)GetValue(BackgroundImageSynchronousLoadingProperty);
2861 SetValue(BackgroundImageSynchronousLoadingProperty, value);
2862 NotifyPropertyChanged();
2866 private bool InternalBackgroundImageSynchronousLoading
2870 return backgroundImageSynchronousLoading;
2874 backgroundImageSynchronousLoading = value;
2876 string bgUrl = null;
2877 var pValue = Background.Find(ImageVisualProperty.URL);
2878 pValue?.Get(out bgUrl);
2881 if (!string.IsNullOrEmpty(bgUrl))
2883 PropertyMap bgMap = this.Background;
2884 var temp = new PropertyValue(backgroundImageSynchronousLoading);
2885 bgMap[ImageVisualProperty.SynchronousLoading] = temp;
2892 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2893 [EditorBrowsable(EditorBrowsableState.Never)]
2894 public Vector2 UpdateSizeHint
2898 return (Vector2)GetValue(UpdateSizeHintProperty);
2902 SetValue(UpdateSizeHintProperty, value);
2903 NotifyPropertyChanged();
2908 /// Enable/Disable ControlState propagation for children.
2909 /// It is false by default.
2910 /// If the View needs to share ControlState with descendants, please set it true.
2911 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2913 [EditorBrowsable(EditorBrowsableState.Never)]
2914 public bool EnableControlStatePropagation
2918 return (bool)GetValue(EnableControlStatePropagationProperty);
2922 SetValue(EnableControlStatePropagationProperty, value);
2923 NotifyPropertyChanged();
2927 private bool InternalEnableControlStatePropagation
2929 get => themeData?.ControlStatePropagation ?? false;
2932 if (InternalEnableControlStatePropagation == value) return;
2934 if (themeData == null) themeData = new ThemeData();
2936 themeData.ControlStatePropagation = value;
2938 foreach (View child in Children)
2940 child.EnableControlStatePropagation = value;
2946 /// By default, it is false in View, true in Control.
2947 /// Note that if the value is true, the View will be a touch receptor.
2949 [EditorBrowsable(EditorBrowsableState.Never)]
2950 public bool EnableControlState
2954 return (bool)GetValue(EnableControlStateProperty);
2958 SetValue(EnableControlStateProperty, value);
2963 /// Whether the actor grab all touches even if touch leaves its boundary.
2965 /// <returns>true, if it grab all touch after start</returns>
2966 [EditorBrowsable(EditorBrowsableState.Never)]
2967 public bool GrabTouchAfterLeave
2971 return (bool)GetValue(GrabTouchAfterLeaveProperty);
2975 SetValue(GrabTouchAfterLeaveProperty, value);
2979 private bool InternalGrabTouchAfterLeave
2984 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2985 pValue.Get(out temp);
2991 var temp = new Tizen.NUI.PropertyValue(value);
2992 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2994 NotifyPropertyChanged();
2999 /// Determines which blend equation will be used to render renderers of this actor.
3001 /// <returns>blend equation enum currently assigned</returns>
3002 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
3003 [EditorBrowsable(EditorBrowsableState.Never)]
3004 public BlendEquationType BlendEquation
3008 return (BlendEquationType)GetValue(BlendEquationProperty);
3012 SetValue(BlendEquationProperty, value);
3016 private BlendEquationType InternalBlendEquation
3021 var pValue = GetProperty(View.Property.BlendEquation);
3022 pValue.Get(out temp);
3024 return (BlendEquationType)temp;
3028 var temp = new Tizen.NUI.PropertyValue((int)value);
3029 SetProperty(View.Property.BlendEquation, temp);
3031 NotifyPropertyChanged();
3036 /// If the value is true, the View will change its style as the theme changes.
3037 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
3039 /// <since_tizen> 9 </since_tizen>
3040 public bool ThemeChangeSensitive
3042 get => (bool)GetValue(ThemeChangeSensitiveProperty);
3043 set => SetValue(ThemeChangeSensitiveProperty, value);
3047 /// Create Style, it is abstract function and must be override.
3049 [EditorBrowsable(EditorBrowsableState.Never)]
3050 protected virtual ViewStyle CreateViewStyle()
3052 return new ViewStyle();
3056 /// Called after the View's ControlStates changed.
3058 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
3059 [EditorBrowsable(EditorBrowsableState.Never)]
3060 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
3066 [EditorBrowsable(EditorBrowsableState.Never)]
3067 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
3069 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
3070 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
3074 /// Apply style instance to the view.
3075 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
3077 /// <since_tizen> 9 </since_tizen>
3078 public virtual void ApplyStyle(ViewStyle viewStyle)
3080 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
3082 if (themeData == null) themeData = new ThemeData();
3084 themeData.viewStyle = viewStyle;
3086 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
3092 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
3094 if (bindablePropertyOfView == null)
3099 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
3100 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
3102 foreach (var sourceProperty in dirtyStyleProperties)
3104 var sourceValue = viewStyle.GetValue(sourceProperty);
3106 if (sourceValue == null)
3111 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
3113 if (destinationProperty != null)
3115 SetValue(destinationProperty, sourceValue);
3121 /// Get whether the View is culled or not.
3122 /// True means that the View is out of the view frustum.
3125 /// Hidden-API (Inhouse-API).
3127 [EditorBrowsable(EditorBrowsableState.Never)]
3133 var pValue = GetProperty(View.Property.Culled);
3134 pValue.Get(out temp);
3141 /// Set or Get TransitionOptions for the page transition.
3142 /// This property is used to define how this view will be transitioned during Page switching.
3144 /// <since_tizen> 9 </since_tizen>
3145 public TransitionOptions TransitionOptions
3149 return GetValue(TransitionOptionsProperty) as TransitionOptions;
3153 SetValue(TransitionOptionsProperty, value);
3154 NotifyPropertyChanged();
3158 private TransitionOptions InternalTransitionOptions
3162 transitionOptions = value;
3166 return transitionOptions;
3171 /// Gets or sets the status of whether the view should emit key event signals.
3172 /// If a View's DispatchKeyEvents is set to false, then it's children will not emit a key event signal either.
3174 [EditorBrowsable(EditorBrowsableState.Never)]
3175 public bool DispatchKeyEvents
3179 return (bool)GetValue(DispatchKeyEventsProperty);
3183 SetValue(DispatchKeyEventsProperty, value);
3184 NotifyPropertyChanged();