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);
88 RegisterAccessibilityDelegate();
92 /// Creates a new instance of a view.
94 /// <since_tizen> 3 </since_tizen>
95 public View() : this(Interop.View.New(), true)
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
101 [EditorBrowsable(EditorBrowsableState.Never)]
102 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
107 /// Create a new instance of a View with setting the status of shown or hidden.
109 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
110 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public View(bool shown) : this(Interop.View.New(), true)
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
129 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
131 InitializeStyle(viewStyle);
134 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
138 PositionUsesPivotPoint = false;
141 onWindowSendEventCallback = SendViewAddedEventToWindow;
142 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
143 signal?.Connect(onWindowSendEventCallback);
151 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162 /// The event that is triggered when the View's ControlState is changed.
164 [EditorBrowsable(EditorBrowsableState.Never)]
165 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
167 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
171 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
173 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
174 [EditorBrowsable(EditorBrowsableState.Never)]
175 public bool LayoutSet
184 /// Flag to allow Layouting to be disabled for Views.
185 /// Once a View has a Layout set then any children added to Views from then on will receive
186 /// automatic Layouts.
188 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
189 [EditorBrowsable(EditorBrowsableState.Never)]
190 public static bool LayoutingDisabled { get; set; } = true;
193 /// Deprecate. Please do not use this.
194 /// The style instance applied to this view.
195 /// Note that please do not modify the ViewStyle.
196 /// Modifying ViewStyle will affect other views with same ViewStyle.
198 [EditorBrowsable(EditorBrowsableState.Never)]
199 protected ViewStyle ViewStyle
203 if (themeData == null) themeData = new ThemeData();
205 if (themeData.viewStyle == null)
207 ApplyStyle(CreateViewStyle());
209 return themeData.viewStyle;
214 /// Get/Set the control state.
215 /// Note that the ControlState only available for the classes derived from Control.
216 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
217 /// please set <see cref="EnableControlState"/> to true.
219 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
220 [EditorBrowsable(EditorBrowsableState.Never)]
221 public ControlState ControlState
225 return themeData == null ? ControlState.Normal : themeData.controlStates;
229 if (ControlState == value)
234 var prevState = ControlState;
236 if (themeData == null) themeData = new ThemeData();
237 themeData.controlStates = value;
239 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
241 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
243 if (themeData.ControlStatePropagation)
245 foreach (View child in Children)
247 child.ControlState = value;
251 OnControlStateChanged(changeInfo);
253 ControlStateChangedEvent?.Invoke(this, changeInfo);
258 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
260 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
261 [EditorBrowsable(EditorBrowsableState.Never)]
262 public bool ExcludeLayouting
266 return (bool)GetValue(ExcludeLayoutingProperty);
270 SetValue(ExcludeLayoutingProperty, value);
271 NotifyPropertyChanged();
275 private bool InternalExcludeLayouting
279 return excludeLayouting;
283 excludeLayouting = value;
284 if (Layout != null && Layout.SetPositionByLayout == value)
286 Layout.SetPositionByLayout = !value;
287 Layout.RequestLayout();
292 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
293 [EditorBrowsable(EditorBrowsableState.Never)]
294 public bool IsResourcesCreated
298 return Application.Current.IsResourcesCreated;
302 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
303 [EditorBrowsable(EditorBrowsableState.Never)]
304 public ResourceDictionary XamlResources
308 return Application.Current.XamlResources;
312 Application.Current.XamlResources = value;
317 /// The StyleName, type string.
318 /// The value indicates DALi style name defined in json theme file.
320 /// <since_tizen> 3 </since_tizen>
321 public string StyleName
325 return (string)GetValue(StyleNameProperty);
329 SetValue(StyleNameProperty, value);
330 NotifyPropertyChanged();
335 /// The KeyInputFocus, type bool.
337 [EditorBrowsable(EditorBrowsableState.Never)]
338 public bool KeyInputFocus
342 return (bool)GetValue(KeyInputFocusProperty);
346 SetValue(KeyInputFocusProperty, value);
347 NotifyPropertyChanged();
352 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
356 /// The property cascade chaining set is not recommended.
359 /// Animatable - This property can be animated using <c>Animation</c> class.
361 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
366 /// This way is recommended for setting the property
368 /// var view = new View();
369 /// view.BackgroundColor = new Color(0.5f, 0.1f, 0, 1);
371 /// This way to set the property is prohibited
373 /// view.BackgroundColor.R = 0.5f; //This does not guarantee a proper operation
376 /// <since_tizen> 3 </since_tizen>
377 public Color BackgroundColor
381 return (Color)GetValue(BackgroundColorProperty);
385 SetValue(BackgroundColorProperty, value);
386 NotifyPropertyChanged();
391 /// The mutually exclusive with "backgroundColor" and "background" type Map.
393 /// <since_tizen> 3 </since_tizen>
394 public string BackgroundImage
398 return (string)GetValue(BackgroundImageProperty);
402 SetValue(BackgroundImageProperty, value);
403 NotifyPropertyChanged();
408 /// Get or set the border of background image.
410 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
411 [EditorBrowsable(EditorBrowsableState.Never)]
412 public Rectangle BackgroundImageBorder
416 return (Rectangle)GetValue(BackgroundImageBorderProperty);
420 SetValue(BackgroundImageBorderProperty, value);
421 NotifyPropertyChanged();
426 /// The background of view.
428 /// <since_tizen> 3 </since_tizen>
429 public Tizen.NUI.PropertyMap Background
433 return (PropertyMap)GetValue(BackgroundProperty);
437 SetValue(BackgroundProperty, value);
438 NotifyPropertyChanged();
443 /// Describes a shadow as an image for a View.
444 /// It is null by default.
447 /// Getter returns copied instance of current shadow.
450 /// The mutually exclusive with "BoxShadow".
454 /// Animatable - This property can be animated using <c>Animation</c> class.
455 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
457 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
459 /// Animatable sub-property : Offset.
462 [EditorBrowsable(EditorBrowsableState.Never)]
463 public ImageShadow ImageShadow
467 return (ImageShadow)GetValue(ImageShadowProperty);
471 SetValue(ImageShadowProperty, value);
472 NotifyPropertyChanged();
477 /// Describes a box shaped shadow drawing for a View.
478 /// It is null by default.
481 /// The mutually exclusive with "ImageShadow".
485 /// Animatable - This property can be animated using <c>Animation</c> class.
486 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
488 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
490 /// Animatable sub-property : Offset, Color, BlurRadius.
493 /// <since_tizen> 9 </since_tizen>
494 public Shadow BoxShadow
498 return (Shadow)GetValue(BoxShadowProperty);
502 SetValue(BoxShadowProperty, value);
503 NotifyPropertyChanged();
508 /// The radius for the rounded corners of the View.
509 /// This will rounds background and shadow edges.
510 /// 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).
511 /// Each radius will clamp internally to the half of smaller of the view's width or height.
512 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
516 /// Animatable - This property can be animated using <c>Animation</c> class.
518 /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10));
522 /// <since_tizen> 9 </since_tizen>
523 public Vector4 CornerRadius
527 return (Vector4)GetValue(CornerRadiusProperty);
531 SetValue(CornerRadiusProperty, value);
532 NotifyPropertyChanged();
537 /// Whether the CornerRadius property value is relative (percentage [0.0f to 0.5f] of the view size) or absolute (in world units).
538 /// It is absolute by default.
539 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
541 /// <since_tizen> 9 </since_tizen>
542 public VisualTransformPolicyType CornerRadiusPolicy
544 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
545 set => SetValue(CornerRadiusPolicyProperty, value);
549 /// The width for the borderline of the View.
553 /// Animatable - This property can be animated using <c>Animation</c> class.
555 /// animation.AnimateTo(view, "BorderlineWidth", 100.0f);
558 /// Note that, an image background may not have borderline if it uses the Border property.
560 /// <since_tizen> 9 </since_tizen>
561 public float BorderlineWidth
565 return (float)GetValue(BorderlineWidthProperty);
569 SetValue(BorderlineWidthProperty, value);
570 NotifyPropertyChanged();
575 /// The color for the borderline of the View.
576 /// It is Color.Black by default.
580 /// Animatable - This property can be animated using <c>Animation</c> class.
582 /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a));
586 /// <since_tizen> 9 </since_tizen>
587 public Color BorderlineColor
591 return (Color)GetValue(BorderlineColorProperty);
595 SetValue(BorderlineColorProperty, value);
596 NotifyPropertyChanged();
601 /// The Relative offset for the borderline of the View.
602 /// Recommended range : [-1.0f to 1.0f].
603 /// If -1.0f, draw borderline inside of the View.
604 /// If 1.0f, draw borderline outside of the View.
605 /// If 0.0f, draw borderline half inside and half outside.
606 /// It is 0.0f by default.
610 /// Animatable - This property can be animated using <c>Animation</c> class.
612 /// animation.AnimateTo(view, "BorderlineOffset", -1.0f);
616 /// <since_tizen> 9 </since_tizen>
617 public float BorderlineOffset
621 return (float)GetValue(BorderlineOffsetProperty);
625 SetValue(BorderlineOffsetProperty, value);
626 NotifyPropertyChanged();
631 /// The current state of the view.
633 /// <since_tizen> 3 </since_tizen>
638 return (States)GetValue(StateProperty);
642 SetValue(StateProperty, value);
643 NotifyPropertyChanged();
648 /// The current sub state of the view.
650 /// <since_tizen> 3 </since_tizen>
651 public States SubState
655 return (States)GetValue(SubStateProperty);
659 SetValue(SubStateProperty, value);
660 NotifyPropertyChanged();
665 /// Displays a tooltip
667 /// <since_tizen> 3 </since_tizen>
668 public Tizen.NUI.PropertyMap Tooltip
672 return (PropertyMap)GetValue(TooltipProperty);
676 SetValue(TooltipProperty, value);
677 NotifyPropertyChanged();
682 /// Displays a tooltip as a text.
684 /// <since_tizen> 3 </since_tizen>
685 public string TooltipText
689 return GetValue(TooltipTextProperty) as string;
693 SetValue(TooltipTextProperty, value);
697 private string InternalTooltipText
701 using (var propertyValue = GetProperty(Property.TOOLTIP))
703 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
705 return retrivedValue;
707 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
708 return "error to get TooltipText";
713 var temp = new Tizen.NUI.PropertyValue(value);
714 SetProperty(View.Property.TOOLTIP, temp);
716 NotifyPropertyChanged();
721 /// The Child property of FlexContainer.<br />
722 /// The proportion of the free space in the container, the flex item will receive.<br />
723 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
725 /// <since_tizen> 3 </since_tizen>
726 [Obsolete("Deprecated in API8, will be removed in API10.")]
731 return (float)GetValue(FlexProperty);
735 SetValue(FlexProperty, value);
736 NotifyPropertyChanged();
741 /// The Child property of FlexContainer.<br />
742 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
744 /// <since_tizen> 3 </since_tizen>
745 [Obsolete("Deprecated in API8, will be removed in API10.")]
750 return (int)GetValue(AlignSelfProperty);
754 SetValue(AlignSelfProperty, value);
755 NotifyPropertyChanged();
760 /// The Child property of FlexContainer.<br />
761 /// The space around the flex item.<br />
764 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
766 /// <since_tizen> 3 </since_tizen>
767 [Obsolete("Deprecated in API8, will be removed in API10.")]
768 public Vector4 FlexMargin
772 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
773 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
777 SetValue(FlexMarginProperty, value);
778 NotifyPropertyChanged();
783 /// The top-left cell this child occupies, if not set, the first available cell is used.
786 /// The property cascade chaining set is not recommended.
787 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
790 /// This way is recommended for setting the property
792 /// var view = new View();
793 /// view.CellIndex = new Vector2(1, 3);
795 /// This way to set the property is prohibited
797 /// view.CellIndex.X = 1; //This does not guarantee a proper operation
800 /// <since_tizen> 3 </since_tizen>
801 public Vector2 CellIndex
805 return (Vector2)GetValue(CellIndexProperty);
809 SetValue(CellIndexProperty, value);
810 NotifyPropertyChanged();
815 /// The number of rows this child occupies, if not set, the default value is 1.
818 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
820 /// <since_tizen> 3 </since_tizen>
825 return (float)GetValue(RowSpanProperty);
829 SetValue(RowSpanProperty, value);
830 NotifyPropertyChanged();
835 /// The number of columns this child occupies, if not set, the default value is 1.
838 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
840 /// <since_tizen> 3 </since_tizen>
841 public float ColumnSpan
845 return (float)GetValue(ColumnSpanProperty);
849 SetValue(ColumnSpanProperty, value);
850 NotifyPropertyChanged();
855 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
858 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
860 /// <since_tizen> 3 </since_tizen>
861 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
865 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
869 SetValue(CellHorizontalAlignmentProperty, value);
870 NotifyPropertyChanged();
875 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
878 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
880 /// <since_tizen> 3 </since_tizen>
881 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
885 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
889 SetValue(CellVerticalAlignmentProperty, value);
890 NotifyPropertyChanged();
895 /// The left focusable view.<br />
896 /// This will return null if not set.<br />
897 /// This will also return null if the specified left focusable view is not on a window.<br />
899 /// <since_tizen> 3 </since_tizen>
900 public View LeftFocusableView
902 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
905 return (View)GetValue(LeftFocusableViewProperty);
909 SetValue(LeftFocusableViewProperty, value);
910 NotifyPropertyChanged();
915 /// The right focusable view.<br />
916 /// This will return null if not set.<br />
917 /// This will also return null if the specified right focusable view is not on a window.<br />
919 /// <since_tizen> 3 </since_tizen>
920 public View RightFocusableView
922 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
925 return (View)GetValue(RightFocusableViewProperty);
929 SetValue(RightFocusableViewProperty, value);
930 NotifyPropertyChanged();
935 /// The up focusable view.<br />
936 /// This will return null if not set.<br />
937 /// This will also return null if the specified up focusable view is not on a window.<br />
939 /// <since_tizen> 3 </since_tizen>
940 public View UpFocusableView
942 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
945 return (View)GetValue(UpFocusableViewProperty);
949 SetValue(UpFocusableViewProperty, value);
950 NotifyPropertyChanged();
955 /// The down focusable view.<br />
956 /// This will return null if not set.<br />
957 /// This will also return null if the specified down focusable view is not on a window.<br />
959 /// <since_tizen> 3 </since_tizen>
960 public View DownFocusableView
962 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
965 return (View)GetValue(DownFocusableViewProperty);
969 SetValue(DownFocusableViewProperty, value);
970 NotifyPropertyChanged();
975 /// Whether the view should be focusable by keyboard navigation.
977 /// <since_tizen> 3 </since_tizen>
978 public bool Focusable
982 SetValue(FocusableProperty, value);
983 NotifyPropertyChanged();
987 return (bool)GetValue(FocusableProperty);
992 /// 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.
993 /// Note : Default value is true.
995 [EditorBrowsable(EditorBrowsableState.Never)]
996 public bool FocusableChildren
1000 SetValue(FocusableChildrenProperty, value);
1001 NotifyPropertyChanged();
1005 return (bool)GetValue(FocusableChildrenProperty);
1010 /// Whether this view can focus by touch.
1011 /// If Focusable is false, FocusableInTouch is disabled.
1012 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
1014 [EditorBrowsable(EditorBrowsableState.Never)]
1015 public bool FocusableInTouch
1019 SetValue(FocusableInTouchProperty, value);
1020 NotifyPropertyChanged();
1024 return (bool)GetValue(FocusableInTouchProperty);
1029 /// Retrieves the position of the view.<br />
1030 /// The coordinates are relative to the view's parent.<br />
1032 /// <since_tizen> 3 </since_tizen>
1033 public Position CurrentPosition
1037 return GetCurrentPosition();
1042 /// Sets the size of a view for the width and the height.<br />
1043 /// Geometry can be scaled to fit within this area.<br />
1044 /// This does not interfere with the view's scale factor.<br />
1045 /// The views default depth is the minimum of width and height.<br />
1048 /// The property cascade chaining set is not recommended.
1051 /// This way is recommended for setting the property
1053 /// var view = new View();
1054 /// view.Size2D = new Size2D(100, 200);
1056 /// This way to set the property is prohibited
1058 /// view.Size2D.Width = 100; //This does not guarantee a proper operation
1061 /// <since_tizen> 3 </since_tizen>
1062 public Size2D Size2D
1066 var temp = (Size2D)GetValue(Size2DProperty);
1068 if (this.Layout == null)
1070 if (temp.Width < 0) { temp.Width = 0; }
1071 if (temp.Height < 0) { temp.Height = 0; }
1078 SetValue(Size2DProperty, value);
1080 NotifyPropertyChanged();
1085 /// Retrieves the size of the view.<br />
1086 /// The coordinates are relative to the view's parent.<br />
1088 /// <since_tizen> 3 </since_tizen>
1089 public Size2D CurrentSize
1093 return GetCurrentSize();
1098 /// Retrieves and sets the view's opacity.<br />
1102 /// Animatable - This property can be animated using <c>Animation</c> class.
1104 /// animation.AnimateTo(view, "Opacity", 0.5f);
1108 /// <since_tizen> 3 </since_tizen>
1109 public float Opacity
1113 return (float)GetValue(OpacityProperty);
1117 SetValue(OpacityProperty, value);
1118 NotifyPropertyChanged();
1123 /// Sets the position of the view for X and Y.<br />
1124 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1125 /// If the position inheritance is disabled, sets the world position.<br />
1128 /// The property cascade chaining set is not recommended.
1131 /// This way is recommended for setting the property
1133 /// var view = new View();
1134 /// view.Position2D = new Position2D(100, 200);
1136 /// This way to set the property is prohibited
1138 /// view.Position2D.X = 100; //This does not guarantee a proper operation
1141 /// <since_tizen> 3 </since_tizen>
1142 public Position2D Position2D
1146 return (Position2D)GetValue(Position2DProperty);
1150 SetValue(Position2DProperty, value);
1151 NotifyPropertyChanged();
1156 /// Retrieves the screen position of the view.<br />
1158 /// <since_tizen> 3 </since_tizen>
1159 public Vector2 ScreenPosition
1163 Vector2 temp = new Vector2(0.0f, 0.0f);
1164 var pValue = GetProperty(View.Property.ScreenPosition);
1172 /// Determines whether the pivot point should be used to determine the position of the view.
1173 /// This is false by default.
1175 /// <remarks>If false, then the top-left of the view is used for the position.
1176 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1178 /// <since_tizen> 3 </since_tizen>
1179 public bool PositionUsesPivotPoint
1183 return (bool)GetValue(PositionUsesPivotPointProperty);
1187 SetValue(PositionUsesPivotPointProperty, value);
1188 NotifyPropertyChanged();
1193 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1195 /// <since_tizen> 3 </since_tizen>
1196 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1198 "View view = new View(); " +
1199 "view.PivotPoint = PivotPoint.Center; " +
1200 "view.PositionUsesPivotPoint = true;" +
1201 " Deprecated in API5: Will be removed in API8")]
1202 [EditorBrowsable(EditorBrowsableState.Never)]
1203 public bool PositionUsesAnchorPoint
1207 return (bool)GetValue(PositionUsesAnchorPointProperty);
1211 SetValue(PositionUsesAnchorPointProperty, value);
1215 private bool InternalPositionUsesAnchorPoint
1220 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1221 pValue.Get(out temp);
1227 var temp = new Tizen.NUI.PropertyValue(value);
1228 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1230 NotifyPropertyChanged();
1235 /// Queries whether the view is connected to the stage.<br />
1236 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1238 /// <since_tizen> 3 </since_tizen>
1239 public bool IsOnWindow
1248 /// Gets the depth in the hierarchy for the view.
1250 /// <since_tizen> 3 </since_tizen>
1251 public int HierarchyDepth
1255 return GetHierarchyDepth();
1260 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1263 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1264 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1265 /// The values set by this property will likely change.
1267 /// <since_tizen> 3 </since_tizen>
1268 public int SiblingOrder
1272 return (int)GetValue(SiblingOrderProperty);
1276 SetValue(SiblingOrderProperty, value);
1278 Layout?.ChangeLayoutSiblingOrder(value);
1280 NotifyPropertyChanged();
1285 /// Returns the natural size of the view.
1288 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1290 /// <since_tizen> 5 </since_tizen>
1291 public Vector3 NaturalSize
1295 Vector3 ret = GetNaturalSize();
1296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1302 /// Returns the natural size (Size2D) of the view.
1305 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1307 /// <since_tizen> 4 </since_tizen>
1308 public Size2D NaturalSize2D
1312 Vector3 temp = GetNaturalSize();
1313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1315 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1322 /// Gets or sets the origin of a view within its parent's area.<br />
1323 /// 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 />
1324 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1325 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1327 /// <pre>The view has been initialized.</pre>
1328 /// <since_tizen> 3 </since_tizen>
1329 public Position ParentOrigin
1333 Position tmp = (Position)GetValue(ParentOriginProperty);
1334 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1338 SetValue(ParentOriginProperty, value);
1339 NotifyPropertyChanged();
1344 /// Gets or sets the anchor-point of a view.<br />
1345 /// 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 />
1346 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1347 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1348 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1349 /// <pre>The view has been initialized.</pre>
1352 /// The property cascade chaining set is not recommended.
1355 /// This way is recommended for setting the property
1357 /// var view = new View();
1358 /// view.PivotPoint = PivotPoint.Center;
1360 /// This way to set the property is prohibited
1362 /// view.PivotPoint.X = 0.5f; //This does not guarantee a proper operation
1365 /// <since_tizen> 3 </since_tizen>
1366 public Position PivotPoint
1370 return (Position)GetValue(PivotPointProperty);
1374 SetValue(PivotPointProperty, value);
1375 NotifyPropertyChanged();
1380 /// Gets or sets the size width of the view.
1384 /// Animatable - This property can be animated using <c>Animation</c> class.
1386 /// animation.AnimateTo(view, "SizeWidth", 500.0f);
1390 /// <since_tizen> 3 </since_tizen>
1391 public float SizeWidth
1395 return (float)GetValue(SizeWidthProperty);
1399 SetValue(SizeWidthProperty, value);
1400 NotifyPropertyChanged();
1405 /// Gets or sets the size height of the view.
1409 /// Animatable - This property can be animated using <c>Animation</c> class.
1412 /// animation.AnimateTo(view, "SizeHeight", 500.0f);
1415 /// <since_tizen> 3 </since_tizen>
1416 public float SizeHeight
1420 return (float)GetValue(SizeHeightProperty);
1424 SetValue(SizeHeightProperty, value);
1425 NotifyPropertyChanged();
1430 /// Gets or sets the position of the view.<br />
1431 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1432 /// If the position inheritance is disabled, sets the world position.<br />
1436 /// Animatable - This property can be animated using <c>Animation</c> class.
1438 /// animation.AnimateTo(view, "Position", new Position(50, 0));
1441 /// The property cascade chaining set is not recommended.
1444 /// This way is recommended for setting the property
1446 /// var view = new View();
1447 /// view.Position = new Position(100, 200.5f, 0);
1449 /// This way to set the property is prohibited
1451 /// view.Position.Y = 200.5f; //This does not guarantee a proper operation
1454 /// <since_tizen> 3 </since_tizen>
1455 public Position Position
1459 return (Position)GetValue(PositionProperty);
1463 SetValue(PositionProperty, value);
1464 NotifyPropertyChanged();
1469 /// Gets or sets the position X of the view.
1473 /// Animatable - This property can be animated using <c>Animation</c> class.
1475 /// animation.AnimateTo(view, "PositionX", 50.0f);
1479 /// <since_tizen> 3 </since_tizen>
1480 public float PositionX
1484 return (float)GetValue(PositionXProperty);
1488 SetValue(PositionXProperty, value);
1489 NotifyPropertyChanged();
1494 /// Gets or sets the position Y of the view.
1498 /// Animatable - This property can be animated using <c>Animation</c> class.
1500 /// animation.AnimateTo(view, "PositionY", 50.0f);
1504 /// <since_tizen> 3 </since_tizen>
1505 public float PositionY
1509 return (float)GetValue(PositionYProperty);
1513 SetValue(PositionYProperty, value);
1514 NotifyPropertyChanged();
1519 /// Gets or sets the position Z of the view.
1523 /// Animatable - This property can be animated using <c>Animation</c> class.
1525 /// animation.AnimateTo(view, "PositionZ", 50.0f);
1529 /// <since_tizen> 3 </since_tizen>
1530 public float PositionZ
1534 return (float)GetValue(PositionZProperty);
1538 SetValue(PositionZProperty, value);
1539 NotifyPropertyChanged();
1544 /// Gets or sets the world position of the view.
1546 /// <since_tizen> 3 </since_tizen>
1547 public Vector3 WorldPosition
1551 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1552 var pValue = GetProperty(View.Property.WorldPosition);
1560 /// Gets or sets the orientation of the view.<br />
1561 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1565 /// This is an asynchronous method.
1568 /// Animatable - This property can be animated using <c>Animation</c> class.
1570 /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis));
1574 /// <since_tizen> 3 </since_tizen>
1575 public Rotation Orientation
1579 return (Rotation)GetValue(OrientationProperty);
1583 SetValue(OrientationProperty, value);
1584 NotifyPropertyChanged();
1589 /// Gets or sets the world orientation of the view.<br />
1591 /// <since_tizen> 3 </since_tizen>
1592 public Rotation WorldOrientation
1596 Rotation temp = new Rotation();
1597 var pValue = GetProperty(View.Property.WorldOrientation);
1605 /// Gets or sets the scale factor applied to the view.<br />
1609 /// Animatable - This property can be animated using <c>Animation</c> class.
1611 /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f));
1614 /// The property cascade chaining set is not recommended.
1617 /// This way is recommended for setting the property
1619 /// var view = new View();
1620 /// view.Scale = new Vector3(1.5f, 2.0f, 1.0f);
1622 /// This way to set the property is prohibited
1624 /// view.Scale.Width = 1.5f; //This does not guarantee a proper operation
1627 /// <since_tizen> 3 </since_tizen>
1628 public Vector3 Scale
1632 return (Vector3)GetValue(ScaleProperty);
1636 SetValue(ScaleProperty, value);
1637 NotifyPropertyChanged();
1642 /// Gets or sets the scale X factor applied to the view.
1646 /// Animatable - This property can be animated using <c>Animation</c> class.
1648 /// animation.AnimateTo(view, "ScaleX", 1.5f);
1652 /// <since_tizen> 3 </since_tizen>
1657 return (float)GetValue(ScaleXProperty);
1661 SetValue(ScaleXProperty, value);
1662 NotifyPropertyChanged();
1667 /// Gets or sets the scale Y factor applied to the view.
1671 /// Animatable - This property can be animated using <c>Animation</c> class.
1673 /// animation.AnimateTo(view, "ScaleY", 1.5f);
1677 /// <since_tizen> 3 </since_tizen>
1682 return (float)GetValue(ScaleYProperty);
1686 SetValue(ScaleYProperty, value);
1687 NotifyPropertyChanged();
1692 /// Gets or sets the scale Z factor applied to the view.
1696 /// Animatable - This property can be animated using <c>Animation</c> class.
1698 /// animation.AnimateTo(view, "ScaleZ", 1.5f);
1702 /// <since_tizen> 3 </since_tizen>
1707 return (float)GetValue(ScaleZProperty);
1711 SetValue(ScaleZProperty, value);
1712 NotifyPropertyChanged();
1717 /// Gets the world scale of the view.
1719 /// <since_tizen> 3 </since_tizen>
1720 public Vector3 WorldScale
1724 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1725 var pValue = GetProperty(View.Property.WorldScale);
1733 /// Retrieves the visibility flag of the view.
1737 /// If the view is not visible, then the view and its children will not be rendered.
1738 /// 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.
1741 /// Animatable - This property can be animated using <c>Animation</c> class.
1743 /// animation.AnimateTo(view, "Visibility", false);
1747 /// <since_tizen> 3 </since_tizen>
1748 public bool Visibility
1753 var pValue = GetProperty(View.Property.VISIBLE);
1754 pValue.Get(out temp);
1761 /// Gets the view's world color.
1763 /// <since_tizen> 3 </since_tizen>
1764 public Vector4 WorldColor
1768 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1769 var pValue = GetProperty(View.Property.WorldColor);
1777 /// Gets or sets the view's name.
1779 /// <since_tizen> 3 </since_tizen>
1784 return (string)GetValue(NameProperty);
1788 SetValue(NameProperty, value);
1789 NotifyPropertyChanged();
1794 /// Get the number of children held by the view.
1796 /// <since_tizen> 3 </since_tizen>
1797 public new uint ChildCount
1801 return Convert.ToUInt32(Children.Count);
1806 /// Gets the view's ID.
1809 /// <since_tizen> 3 </since_tizen>
1819 /// Gets or sets the status of whether the view should emit touch or hover signals.
1820 /// If a View is made insensitive, then the View and its children are not hittable.
1822 /// <since_tizen> 3 </since_tizen>
1823 public bool Sensitive
1827 return (bool)GetValue(SensitiveProperty);
1831 SetValue(SensitiveProperty, value);
1832 NotifyPropertyChanged();
1837 /// 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.
1839 /// <since_tizen> 3 </since_tizen>
1840 public bool LeaveRequired
1844 return (bool)GetValue(LeaveRequiredProperty);
1848 SetValue(LeaveRequiredProperty, value);
1849 NotifyPropertyChanged();
1854 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1856 /// <since_tizen> 3 </since_tizen>
1857 public bool InheritOrientation
1861 return (bool)GetValue(InheritOrientationProperty);
1865 SetValue(InheritOrientationProperty, value);
1866 NotifyPropertyChanged();
1871 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1873 /// <since_tizen> 3 </since_tizen>
1874 public bool InheritScale
1878 return (bool)GetValue(InheritScaleProperty);
1882 SetValue(InheritScaleProperty, value);
1883 NotifyPropertyChanged();
1888 /// Gets or sets the status of how the view and its children should be drawn.<br />
1889 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1890 /// 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 />
1891 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1892 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1893 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1895 /// <since_tizen> 3 </since_tizen>
1896 public DrawModeType DrawMode
1900 return (DrawModeType)GetValue(DrawModeProperty);
1904 SetValue(DrawModeProperty, value);
1905 NotifyPropertyChanged();
1910 /// Gets or sets the relative to parent size factor of the view.<br />
1911 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1912 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1915 /// The property cascade chaining set is not recommended.
1918 /// This way is recommended for setting the property
1920 /// var text = new TextField();
1921 /// text.SizeModeFactor = new Vector3(1.0f, 0.45f, 1.0f);
1923 /// This way to set the property is prohibited
1925 /// text.SizeModeFactor.Width = 1.0f; //This does not guarantee a proper operation
1928 /// <since_tizen> 3 </since_tizen>
1929 public Vector3 SizeModeFactor
1933 return (Vector3)GetValue(SizeModeFactorProperty);
1937 SetValue(SizeModeFactorProperty, value);
1938 NotifyPropertyChanged();
1943 /// Gets or sets the width resize policy to be used.
1945 /// <since_tizen> 3 </since_tizen>
1946 public ResizePolicyType WidthResizePolicy
1950 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1954 SetValue(WidthResizePolicyProperty, value);
1955 NotifyPropertyChanged();
1960 /// Gets or sets the height resize policy to be used.
1962 /// <since_tizen> 3 </since_tizen>
1963 public ResizePolicyType HeightResizePolicy
1967 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1971 SetValue(HeightResizePolicyProperty, value);
1972 NotifyPropertyChanged();
1977 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1978 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1980 /// <since_tizen> 3 </since_tizen>
1981 public SizeScalePolicyType SizeScalePolicy
1985 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1989 SetValue(SizeScalePolicyProperty, value);
1990 NotifyPropertyChanged();
1995 /// Gets or sets the status of whether the width size is dependent on the height size.
1997 /// <since_tizen> 3 </since_tizen>
1998 public bool WidthForHeight
2002 return (bool)GetValue(WidthForHeightProperty);
2006 SetValue(WidthForHeightProperty, value);
2007 NotifyPropertyChanged();
2012 /// Gets or sets the status of whether the height size is dependent on the width size.
2014 /// <since_tizen> 3 </since_tizen>
2015 public bool HeightForWidth
2019 return (bool)GetValue(HeightForWidthProperty);
2023 SetValue(HeightForWidthProperty, value);
2024 NotifyPropertyChanged();
2029 /// Gets or sets the padding for use in layout.
2032 /// The property cascade chaining set is not recommended.
2035 /// This way is recommended for setting the property
2037 /// var view = new View();
2038 /// view.Padding = new Extents(5, 5, 5, 5);
2040 /// This way to set the property is prohibited
2042 /// view.Padding.Start = 5; //This does not guarantee a proper operation
2045 /// <since_tizen> 5 </since_tizen>
2046 public Extents Padding
2050 // If View has a Layout then padding in stored in the base Layout class
2053 return Layout.Padding;
2057 return (Extents)GetValue(PaddingProperty);
2059 // Two return points to prevent creating a zeroed Extent native object before assignment
2063 Extents padding = value;
2066 // Layout set so store Padding in LayoutItem instead of in View.
2067 // If View stores the Padding value then Legacy Size Negotiation will overwrite
2068 // the position and sizes measure in the Layouting.
2069 Layout.Padding = value;
2070 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2071 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2072 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
2074 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
2078 SetValue(PaddingProperty, padding);
2079 NotifyPropertyChanged();
2084 /// Gets or sets the minimum size the view can be assigned in size negotiation.
2086 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2088 /// The property cascade chaining set is not recommended.
2091 /// This way is recommended for setting the property
2093 /// var view = new View();
2094 /// view.MinimumSize = new Size2D(100, 200);
2096 /// This way to set the property is prohibited
2098 /// view.MinimumSize.Width = 100; //This does not guarantee a proper operation
2101 /// <since_tizen> 3 </since_tizen>
2102 public Size2D MinimumSize
2106 return (Size2D)GetValue(MinimumSizeProperty);
2112 throw new ArgumentNullException(nameof(value));
2116 // Note: it only works if minimum size is >= than natural size.
2117 // To force the size it should be done through the width&height spec or Size2D.
2118 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
2119 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
2120 layout.RequestLayout();
2122 SetValue(MinimumSizeProperty, value);
2123 NotifyPropertyChanged();
2128 /// Gets or sets the maximum size the view can be assigned in size negotiation.
2131 /// This way is recommended for setting the property
2133 /// var view = new View();
2134 /// view.MaximumSize = new Size2D(100, 200);
2136 /// This way to set the property is prohibited
2138 /// view.MaximumSize.Height = 200; //This does not guarantee a proper operation
2141 /// <since_tizen> 3 </since_tizen>
2142 public Size2D MaximumSize
2146 return (Size2D)GetValue(MaximumSizeProperty);
2150 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
2151 // MATCH_PARENT spec + parent container size can be used to limit
2154 layout.RequestLayout();
2156 SetValue(MaximumSizeProperty, value);
2157 NotifyPropertyChanged();
2162 /// Gets or sets whether a child view inherits it's parent's position.<br />
2163 /// Default is to inherit.<br />
2164 /// 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 />
2166 /// <since_tizen> 3 </since_tizen>
2167 public bool InheritPosition
2171 return (bool)GetValue(InheritPositionProperty);
2175 SetValue(InheritPositionProperty, value);
2176 NotifyPropertyChanged();
2181 /// Gets or sets the clipping behavior (mode) of it's children.
2183 /// <since_tizen> 3 </since_tizen>
2184 public ClippingModeType ClippingMode
2188 return (ClippingModeType)GetValue(ClippingModeProperty);
2192 SetValue(ClippingModeProperty, value);
2193 NotifyPropertyChanged();
2198 /// Gets the number of renderers held by the view.
2200 /// <since_tizen> 3 </since_tizen>
2201 public uint RendererCount
2205 return GetRendererCount();
2210 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2213 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2215 /// <since_tizen> 3 </since_tizen>
2216 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2218 "View view = new View(); " +
2219 "view.PivotPoint = PivotPoint.Center; " +
2220 "view.PositionUsesPivotPoint = true;")]
2221 [EditorBrowsable(EditorBrowsableState.Never)]
2222 public Position AnchorPoint
2226 return GetValue(AnchorPointProperty) as Position;
2230 SetValue(AnchorPointProperty, value);
2234 private Position InternalAnchorPoint
2238 Position temp = new Position(0.0f, 0.0f, 0.0f);
2239 var pValue = GetProperty(View.Property.AnchorPoint);
2242 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2248 var temp = new Tizen.NUI.PropertyValue(value);
2249 SetProperty(View.Property.AnchorPoint, temp);
2251 NotifyPropertyChanged();
2256 /// Sets the size of a view for the width, the height and the depth.<br />
2257 /// Geometry can be scaled to fit within this area.<br />
2258 /// This does not interfere with the view's scale factor.<br />
2259 /// The views default depth is the minimum of width and height.<br />
2263 /// Animatable - This property can be animated using <c>Animation</c> class.
2265 /// animation.AnimateTo(view, "Size", new Size(100, 100));
2268 /// The property cascade chaining set is not recommended.
2271 /// This way is recommended for setting the property
2273 /// var view = new View();
2274 /// view.Size = new Size(100.5f, 200, 0);
2276 /// This way to set the property is prohibited
2278 /// view.Size.Width = 100.5f; //This does not guarantee a proper operation
2281 /// <since_tizen> 5 </since_tizen>
2286 return (Size)GetValue(SizeProperty);
2290 SetValue(SizeProperty, value);
2291 NotifyPropertyChanged();
2296 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2298 /// <since_tizen> 3 </since_tizen>
2299 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2301 "Container parent = view.GetParent(); " +
2302 "View view = parent as View;")]
2303 [EditorBrowsable(EditorBrowsableState.Never)]
2304 public new View Parent
2309 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2310 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2311 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2313 if (basehandle is Layer layer)
2315 ret = new View(Layer.getCPtr(layer).Handle, false);
2316 NUILog.Error("This Parent property is deprecated, should do not be used");
2320 ret = basehandle as View;
2323 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2324 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2326 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2332 /// Gets/Sets whether inherit parent's the layout Direction.
2334 /// <since_tizen> 4 </since_tizen>
2335 public bool InheritLayoutDirection
2339 return (bool)GetValue(InheritLayoutDirectionProperty);
2343 SetValue(InheritLayoutDirectionProperty, value);
2344 NotifyPropertyChanged();
2349 /// Gets/Sets the layout Direction.
2351 /// <since_tizen> 4 </since_tizen>
2352 public ViewLayoutDirectionType LayoutDirection
2356 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2360 SetValue(LayoutDirectionProperty, value);
2361 NotifyPropertyChanged();
2362 layout?.RequestLayout();
2367 /// Gets or sets the Margin for use in layout.
2370 /// Margin property is supported by Layout algorithms and containers.
2371 /// Please Set Layout if you want to use Margin property.
2372 /// The property cascade chaining set is not recommended.
2375 /// This way is recommended for setting the property
2377 /// var view = new View();
2378 /// view.Margin = new Extents(10, 5, 15, 20);
2380 /// This way to set the property is prohibited
2382 /// view.Margin.Top = 15; //This does not guarantee a proper operation
2385 /// <since_tizen> 4 </since_tizen>
2386 public Extents Margin
2390 // If View has a Layout then margin is stored in Layout.
2393 return Layout.Margin;
2397 // If Layout not set then return margin stored in View.
2398 return (Extents)GetValue(MarginProperty);
2400 // Two return points to prevent creating a zeroed Extent native object before assignment
2406 // Layout set so store Margin in LayoutItem instead of View.
2407 // If View stores the Margin too then the Legacy Size Negotiation will
2408 // overwrite the position and size values measured in the Layouting.
2409 Layout.Margin = value;
2410 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2411 layout?.RequestLayout();
2415 SetValue(MarginProperty, value);
2417 NotifyPropertyChanged();
2418 layout?.RequestLayout();
2423 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2427 /// // matchParentView matches its size to its parent size.
2428 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2429 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2431 /// // wrapContentView wraps its children with their desired size.
2432 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2433 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2435 /// // exactSizeView shows itself with an exact size.
2436 /// exactSizeView.WidthSpecification = 100;
2437 /// exactSizeView.HeightSpecification = 100;
2440 /// <since_tizen> 6 </since_tizen>
2441 [Binding.TypeConverter(typeof(IntGraphicsTypeConverter))]
2442 public int WidthSpecification
2446 return (int)GetValue(WidthSpecificationProperty);
2450 SetValue(WidthSpecificationProperty, value);
2451 NotifyPropertyChanged();
2455 private int InternalWidthSpecification
2463 if (value == widthPolicy)
2466 widthPolicy = value;
2467 if (widthPolicy >= 0)
2469 if (heightPolicy >= 0) // Policy an exact value
2471 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2472 Size2D = new Size2D(widthPolicy, heightPolicy);
2475 layout?.RequestLayout();
2480 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2484 /// // matchParentView matches its size to its parent size.
2485 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2486 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2488 /// // wrapContentView wraps its children with their desired size.
2489 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2490 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2492 /// // exactSizeView shows itself with an exact size.
2493 /// exactSizeView.WidthSpecification = 100;
2494 /// exactSizeView.HeightSpecification = 100;
2497 /// <since_tizen> 6 </since_tizen>
2498 [Binding.TypeConverter(typeof(IntGraphicsTypeConverter))]
2499 public int HeightSpecification
2503 return (int)GetValue(HeightSpecificationProperty);
2507 SetValue(HeightSpecificationProperty, value);
2508 NotifyPropertyChanged();
2512 private int InternalHeightSpecification
2516 return heightPolicy;
2520 if (value == heightPolicy)
2523 heightPolicy = value;
2524 if (heightPolicy >= 0)
2526 if (widthPolicy >= 0) // Policy an exact value
2528 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2529 Size2D = new Size2D(widthPolicy, heightPolicy);
2532 layout?.RequestLayout();
2537 /// Gets the List of transitions for this View.
2539 /// <since_tizen> 6 </since_tizen>
2540 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2544 if (layoutTransitions == null)
2546 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2548 return layoutTransitions;
2553 /// Sets a layout transitions for this View.
2555 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2557 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2559 /// <since_tizen> 6 </since_tizen>
2560 public LayoutTransition LayoutTransition
2564 return GetValue(LayoutTransitionProperty) as LayoutTransition;
2568 SetValue(LayoutTransitionProperty, value);
2569 NotifyPropertyChanged();
2573 private LayoutTransition InternalLayoutTransition
2577 return layoutTransition;
2583 throw new global::System.ArgumentNullException(nameof(value));
2585 if (layoutTransitions == null)
2587 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2590 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2592 AttachTransitionsToChildren(value);
2594 layoutTransition = value;
2599 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2602 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2604 /// <since_tizen> 4 </since_tizen>
2605 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2606 [EditorBrowsable(EditorBrowsableState.Never)]
2607 public Extents PaddingEX
2611 return GetValue(PaddingEXProperty) as Extents;
2615 SetValue(PaddingEXProperty, value);
2619 private Extents InternalPaddingEX
2623 Extents temp = new Extents(0, 0, 0, 0);
2624 var pValue = GetProperty(View.Property.PADDING);
2627 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2633 var temp = new Tizen.NUI.PropertyValue(value);
2634 SetProperty(View.Property.PADDING, temp);
2636 NotifyPropertyChanged();
2637 layout?.RequestLayout();
2641 [EditorBrowsable(EditorBrowsableState.Never)]
2642 public XamlStyle XamlStyle
2646 return (XamlStyle)GetValue(XamlStyleProperty);
2650 SetValue(XamlStyleProperty, value);
2655 /// The Color of View. This is an RGBA value.
2659 /// Animatable - This property can be animated using <c>Animation</c> class.
2661 /// The property cascade chaining set is not recommended.
2664 /// This way is recommended for setting the property
2666 /// var view = new View();
2667 /// view.Color = new Color(0.5f, 0.2f, 0.1f, 0.5f);
2669 /// This way to set the property is prohibited
2671 /// view.Color.A = 0.5f; //This does not guarantee a proper operation
2674 [EditorBrowsable(EditorBrowsableState.Never)]
2679 return (Color)GetValue(ColorProperty);
2683 SetValue(ColorProperty, value);
2684 NotifyPropertyChanged();
2689 /// Set the layout on this View. Replaces any existing Layout.
2692 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2694 /// <since_tizen> 6 </since_tizen>
2695 public LayoutItem Layout
2699 return GetValue(LayoutProperty) as LayoutItem;
2703 SetValue(LayoutProperty, value);
2707 private LayoutItem InternalLayout
2715 // Do nothing if layout provided is already set on this View.
2716 if (value == layout)
2721 LayoutingDisabled = false;
2724 // If new layout being set already has a owner then that owner receives a replacement default layout.
2725 // First check if the layout to be set already has a owner.
2726 if (value?.Owner != null)
2728 // Previous owner of the layout gets a default layout as a replacement.
2729 value.Owner.Layout = new AbsoluteLayout()
2731 // Copy Margin and Padding to replacement LayoutGroup.
2732 Margin = value.Margin,
2733 Padding = value.Padding,
2737 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2738 // View if no replacement. Previously margin and padding values would have been moved from
2739 // the View to the layout.
2740 if (layout != null) // Existing layout
2744 // Existing layout being replaced so copy over margin and padding values.
2745 value.Margin = layout.Margin;
2746 value.Padding = layout.Padding;
2747 value.SetPositionByLayout = !excludeLayouting;
2751 // Layout not being replaced so restore margin and padding to View.
2752 SetValue(MarginProperty, layout.Margin);
2753 SetValue(PaddingProperty, layout.Padding);
2754 NotifyPropertyChanged();
2759 // First Layout to be added to the View hence copy
2761 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2764 Extents margin = Margin;
2765 Extents padding = Padding;
2766 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2768 // If View already has a margin set then store it in Layout instead.
2769 value.Margin = margin;
2770 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2771 NotifyPropertyChanged();
2774 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2776 // If View already has a padding set then store it in Layout instead.
2777 value.Padding = padding;
2779 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2780 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2781 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2783 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2784 NotifyPropertyChanged();
2788 value.SetPositionByLayout = !excludeLayouting;
2792 // Remove existing layout from it's parent layout group.
2795 // Set layout to this view
2801 /// The weight of the View, used to share available space in a layout with siblings.
2803 /// <since_tizen> 6 </since_tizen>
2813 layout?.RequestLayout();
2818 /// Whether to load the BackgroundImage synchronously.
2819 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2820 /// Note: For Normal Quad images only.
2822 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2823 [EditorBrowsable(EditorBrowsableState.Never)]
2824 public bool BackgroundImageSynchronosLoading
2828 return (bool)GetValue(BackgroundImageSynchronosLoadingProperty);
2832 SetValue(BackgroundImageSynchronosLoadingProperty, value);
2833 NotifyPropertyChanged();
2837 private bool InternalBackgroundImageSynchronosLoading
2841 return BackgroundImageSynchronousLoading;
2845 BackgroundImageSynchronousLoading = value;
2850 /// Whether to load the BackgroundImage synchronously.
2851 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2852 /// Note: For Normal Quad images only.
2854 /// This will be public opened in tizen_7.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2855 [EditorBrowsable(EditorBrowsableState.Never)]
2856 public bool BackgroundImageSynchronousLoading
2860 return (bool)GetValue(BackgroundImageSynchronousLoadingProperty);
2864 SetValue(BackgroundImageSynchronousLoadingProperty, value);
2865 NotifyPropertyChanged();
2869 private bool InternalBackgroundImageSynchronousLoading
2873 return backgroundImageSynchronousLoading;
2877 backgroundImageSynchronousLoading = value;
2879 string bgUrl = null;
2880 var pValue = Background.Find(ImageVisualProperty.URL);
2881 pValue?.Get(out bgUrl);
2884 if (!string.IsNullOrEmpty(bgUrl))
2886 PropertyMap bgMap = this.Background;
2887 var temp = new PropertyValue(backgroundImageSynchronousLoading);
2888 bgMap[ImageVisualProperty.SynchronousLoading] = temp;
2895 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2896 [EditorBrowsable(EditorBrowsableState.Never)]
2897 public Vector2 UpdateSizeHint
2901 return (Vector2)GetValue(UpdateSizeHintProperty);
2905 SetValue(UpdateSizeHintProperty, value);
2906 NotifyPropertyChanged();
2911 /// Enable/Disable ControlState propagation for children.
2912 /// It is false by default.
2913 /// If the View needs to share ControlState with descendants, please set it true.
2914 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2916 [EditorBrowsable(EditorBrowsableState.Never)]
2917 public bool EnableControlStatePropagation
2921 return (bool)GetValue(EnableControlStatePropagationProperty);
2925 SetValue(EnableControlStatePropagationProperty, value);
2926 NotifyPropertyChanged();
2930 private bool InternalEnableControlStatePropagation
2932 get => themeData?.ControlStatePropagation ?? false;
2935 if (InternalEnableControlStatePropagation == value) return;
2937 if (themeData == null) themeData = new ThemeData();
2939 themeData.ControlStatePropagation = value;
2941 foreach (View child in Children)
2943 child.EnableControlStatePropagation = value;
2949 /// By default, it is false in View, true in Control.
2950 /// Note that if the value is true, the View will be a touch receptor.
2952 [EditorBrowsable(EditorBrowsableState.Never)]
2953 public bool EnableControlState
2957 return (bool)GetValue(EnableControlStateProperty);
2961 SetValue(EnableControlStateProperty, value);
2966 /// Whether the actor grab all touches even if touch leaves its boundary.
2968 /// <returns>true, if it grab all touch after start</returns>
2969 [EditorBrowsable(EditorBrowsableState.Never)]
2970 public bool GrabTouchAfterLeave
2974 return (bool)GetValue(GrabTouchAfterLeaveProperty);
2978 SetValue(GrabTouchAfterLeaveProperty, value);
2982 private bool InternalGrabTouchAfterLeave
2987 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2988 pValue.Get(out temp);
2994 var temp = new Tizen.NUI.PropertyValue(value);
2995 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2997 NotifyPropertyChanged();
3002 /// Determines which blend equation will be used to render renderers of this actor.
3004 /// <returns>blend equation enum currently assigned</returns>
3005 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
3006 [EditorBrowsable(EditorBrowsableState.Never)]
3007 public BlendEquationType BlendEquation
3011 return (BlendEquationType)GetValue(BlendEquationProperty);
3015 SetValue(BlendEquationProperty, value);
3019 private BlendEquationType InternalBlendEquation
3024 var pValue = GetProperty(View.Property.BlendEquation);
3025 pValue.Get(out temp);
3027 return (BlendEquationType)temp;
3031 var temp = new Tizen.NUI.PropertyValue((int)value);
3032 SetProperty(View.Property.BlendEquation, temp);
3034 NotifyPropertyChanged();
3039 /// If the value is true, the View will change its style as the theme changes.
3040 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
3042 /// <since_tizen> 9 </since_tizen>
3043 public bool ThemeChangeSensitive
3045 get => (bool)GetValue(ThemeChangeSensitiveProperty);
3046 set => SetValue(ThemeChangeSensitiveProperty, value);
3050 /// Create Style, it is abstract function and must be override.
3052 [EditorBrowsable(EditorBrowsableState.Never)]
3053 protected virtual ViewStyle CreateViewStyle()
3055 return new ViewStyle();
3059 /// Called after the View's ControlStates changed.
3061 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
3062 [EditorBrowsable(EditorBrowsableState.Never)]
3063 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
3069 [EditorBrowsable(EditorBrowsableState.Never)]
3070 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
3072 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
3073 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
3077 /// Apply style instance to the view.
3078 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
3080 /// <since_tizen> 9 </since_tizen>
3081 public virtual void ApplyStyle(ViewStyle viewStyle)
3083 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
3085 if (themeData == null) themeData = new ThemeData();
3087 themeData.viewStyle = viewStyle;
3089 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
3095 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
3097 if (bindablePropertyOfView == null)
3102 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
3103 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
3105 foreach (var sourceProperty in dirtyStyleProperties)
3107 var sourceValue = viewStyle.GetValue(sourceProperty);
3109 if (sourceValue == null)
3114 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
3116 if (destinationProperty != null)
3118 SetValue(destinationProperty, sourceValue);
3124 /// Get whether the View is culled or not.
3125 /// True means that the View is out of the view frustum.
3128 /// Hidden-API (Inhouse-API).
3130 [EditorBrowsable(EditorBrowsableState.Never)]
3136 var pValue = GetProperty(View.Property.Culled);
3137 pValue.Get(out temp);
3144 /// Set or Get TransitionOptions for the page transition.
3145 /// This property is used to define how this view will be transitioned during Page switching.
3147 /// <since_tizen> 9 </since_tizen>
3148 public TransitionOptions TransitionOptions
3152 return GetValue(TransitionOptionsProperty) as TransitionOptions;
3156 SetValue(TransitionOptionsProperty, value);
3157 NotifyPropertyChanged();
3161 private TransitionOptions InternalTransitionOptions
3165 transitionOptions = value;
3169 return transitionOptions;
3174 /// Gets or sets the status of whether the view should emit key event signals.
3175 /// If a View's DispatchKeyEvents is set to false, then it's children will not emit a key event signal either.
3177 [EditorBrowsable(EditorBrowsableState.Never)]
3178 public bool DispatchKeyEvents
3182 return (bool)GetValue(DispatchKeyEventsProperty);
3186 SetValue(DispatchKeyEventsProperty, value);
3187 NotifyPropertyChanged();