2 * Copyright(c) 2019 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;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
33 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
35 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public bool layoutSet = false;
40 /// Flag to allow Layouting to be disabled for Views.
41 /// Once a View has a Layout set then any children added to Views from then on will receive
42 /// automatic Layouts.
44 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public static bool layoutingDisabled{get; set;} = true;
48 private LayoutItem _layout; // Exclusive layout assigned to this View.
50 // List of transitions paired with the condition that uses the transition.
51 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54 private int _oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later
55 private int _oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later
56 private float _weight = 0.0f; // Weighting of child View in a Layout
57 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
58 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
59 private bool _backgroundImageSynchronosLoading = false;
60 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
61 private string[] transitionNames;
62 private bool controlStatePropagation = false;
63 private ViewStyle viewStyle;
65 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
66 internal BackgroundExtraData backgroundExtraData;
70 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
71 [EditorBrowsable(EditorBrowsableState.Never)]
72 public ViewStyle ViewStyle
76 if (null == viewStyle)
78 ApplyStyle(GetViewStyle());
86 /// Creates a new instance of a view.
88 /// <since_tizen> 3 </since_tizen>
89 public View() : this(Interop.View.View_New(), true)
91 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
95 [EditorBrowsable(EditorBrowsableState.Never)]
96 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
98 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
102 /// Create a new instance of a View with setting the status of shown or hidden.
104 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
105 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
106 [EditorBrowsable(EditorBrowsableState.Never)]
107 public View(bool shown) : this(Interop.View.View_New(), true)
109 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
124 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
126 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
129 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
133 PositionUsesPivotPoint = false;
136 _onWindowSendEventCallback = SendViewAddedEventToWindow;
137 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
145 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156 /// The event that is triggered when the View's ControlState is changed.
158 [EditorBrowsable(EditorBrowsableState.Never)]
159 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
161 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
163 private ControlState controlStates = ControlState.Normal;
165 /// Get/Set the control state.
167 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
168 [EditorBrowsable(EditorBrowsableState.Never)]
169 public ControlState ControlState
173 return controlStates;
177 if (controlStates == value)
182 var prevState = controlStates;
184 controlStates = value;
186 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
188 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
190 OnControlStateChanged(changeInfo);
192 if (controlStatePropagation)
194 foreach (View child in Children)
196 child.ControlState = value;
200 ControlStateChangedEvent?.Invoke(this, changeInfo);
204 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
205 [EditorBrowsable(EditorBrowsableState.Never)]
206 public bool IsResourcesCreated
210 return Application.Current.IsResourcesCreated;
214 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
215 [EditorBrowsable(EditorBrowsableState.Never)]
216 public ResourceDictionary XamlResources
220 return Application.Current.XamlResources;
224 Application.Current.XamlResources = value;
229 /// The StyleName, type string.
230 /// The value indicates DALi style name defined in json theme file.
232 /// <since_tizen> 3 </since_tizen>
233 public string StyleName
237 return (string)GetValue(StyleNameProperty);
241 SetValue(StyleNameProperty, value);
242 NotifyPropertyChanged();
247 /// The KeyInputFocus, type bool.
249 [EditorBrowsable(EditorBrowsableState.Never)]
250 public bool KeyInputFocus
254 return (bool)GetValue(KeyInputFocusProperty);
258 SetValue(KeyInputFocusProperty, value);
259 NotifyPropertyChanged();
264 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
267 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
269 /// <since_tizen> 3 </since_tizen>
270 public Color BackgroundColor
274 Color temp = (Color)GetValue(BackgroundColorProperty);
275 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
279 SetValue(BackgroundColorProperty, value);
280 if (selectorData != null)
282 selectorData.BackgroundImage.Reset(this);
283 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
285 NotifyPropertyChanged();
290 /// The mutually exclusive with "backgroundColor" and "background" type Map.
292 /// <since_tizen> 3 </since_tizen>
293 public string BackgroundImage
297 return (string)GetValue(BackgroundImageProperty);
301 SetValue(BackgroundImageProperty, value);
302 if (selectorData != null)
304 selectorData.BackgroundColor.Reset(this);
305 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
307 NotifyPropertyChanged();
312 /// Get or set the border of background image.
314 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
315 [EditorBrowsable(EditorBrowsableState.Never)]
316 public Rectangle BackgroundImageBorder
320 return (Rectangle)GetValue(BackgroundImageBorderProperty);
324 SetValue(BackgroundImageBorderProperty, value);
325 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
326 NotifyPropertyChanged();
331 /// The background of view.
333 /// <since_tizen> 3 </since_tizen>
334 public Tizen.NUI.PropertyMap Background
338 return (PropertyMap)GetValue(BackgroundProperty);
342 SetValue(BackgroundProperty, value);
343 NotifyPropertyChanged();
348 /// Describes a shadow as an image for a View.
349 /// It is null by default.
352 /// Getter returns copied instance of current shadow.
355 /// The mutually exclusive with "BoxShadow".
357 [EditorBrowsable(EditorBrowsableState.Never)]
358 public ImageShadow ImageShadow
362 return (ImageShadow)GetValue(ImageShadowProperty);
366 SetValue(ImageShadowProperty, value);
367 if (selectorData != null)
369 selectorData.BoxShadow.Reset(this);
370 selectorData.ImageShadow.UpdateIfNeeds(this, value);
372 NotifyPropertyChanged();
377 /// Describes a box shaped shadow drawing for a View.
378 /// It is null by default.
381 /// Gettter returns copied instance of current shadow.
384 /// The mutually exclusive with "ImageShadow".
386 [EditorBrowsable(EditorBrowsableState.Never)]
387 public Shadow BoxShadow
391 return (Shadow)GetValue(BoxShadowProperty);
395 SetValue(BoxShadowProperty, value);
396 if (selectorData != null)
398 selectorData.ImageShadow.Reset(this);
399 selectorData.BoxShadow.UpdateIfNeeds(this, value);
401 NotifyPropertyChanged();
406 /// The radius for the rounded corners of the View.
407 /// This will rounds background and shadow edges.
408 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
410 [EditorBrowsable(EditorBrowsableState.Never)]
411 public float CornerRadius
415 return (float)GetValue(CornerRadiusProperty);
419 SetValue(CornerRadiusProperty, value);
420 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
421 NotifyPropertyChanged();
426 /// The current state of the view.
428 /// <since_tizen> 3 </since_tizen>
433 return (States)GetValue(StateProperty);
437 SetValue(StateProperty, value);
438 NotifyPropertyChanged();
443 /// The current sub state of the view.
445 /// <since_tizen> 3 </since_tizen>
446 public States SubState
450 return (States)GetValue(SubStateProperty);
454 SetValue(SubStateProperty, value);
455 NotifyPropertyChanged();
460 /// Displays a tooltip
462 /// <since_tizen> 3 </since_tizen>
463 public Tizen.NUI.PropertyMap Tooltip
467 return (PropertyMap)GetValue(TooltipProperty);
471 SetValue(TooltipProperty, value);
472 NotifyPropertyChanged();
477 /// Displays a tooltip as a text.
479 /// <since_tizen> 3 </since_tizen>
480 public string TooltipText
484 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
485 NotifyPropertyChanged();
490 /// The Child property of FlexContainer.<br />
491 /// The proportion of the free space in the container, the flex item will receive.<br />
492 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
494 /// <since_tizen> 3 </since_tizen>
495 [Obsolete("Deprecated in API8, will be removed in API10.")]
500 return (float)GetValue(FlexProperty);
504 SetValue(FlexProperty, value);
505 NotifyPropertyChanged();
510 /// The Child property of FlexContainer.<br />
511 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
513 /// <since_tizen> 3 </since_tizen>
514 [Obsolete("Deprecated in API8, will be removed in API10.")]
519 return (int)GetValue(AlignSelfProperty);
523 SetValue(AlignSelfProperty, value);
524 NotifyPropertyChanged();
529 /// The Child property of FlexContainer.<br />
530 /// The space around the flex item.<br />
533 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
535 /// <since_tizen> 3 </since_tizen>
536 [Obsolete("Deprecated in API8, will be removed in API10.")]
537 public Vector4 FlexMargin
541 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
542 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
546 SetValue(FlexMarginProperty, value);
547 NotifyPropertyChanged();
552 /// The top-left cell this child occupies, if not set, the first available cell is used.
555 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
557 /// <since_tizen> 3 </since_tizen>
558 public Vector2 CellIndex
562 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
563 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
567 SetValue(CellIndexProperty, value);
568 NotifyPropertyChanged();
573 /// The number of rows this child occupies, if not set, the default value is 1.
575 /// <since_tizen> 3 </since_tizen>
580 return (float)GetValue(RowSpanProperty);
584 SetValue(RowSpanProperty, value);
585 NotifyPropertyChanged();
590 /// The number of columns this child occupies, if not set, the default value is 1.
592 /// <since_tizen> 3 </since_tizen>
593 public float ColumnSpan
597 return (float)GetValue(ColumnSpanProperty);
601 SetValue(ColumnSpanProperty, value);
602 NotifyPropertyChanged();
607 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
609 /// <since_tizen> 3 </since_tizen>
610 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
614 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
618 SetValue(CellHorizontalAlignmentProperty, value);
619 NotifyPropertyChanged();
624 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
626 /// <since_tizen> 3 </since_tizen>
627 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
631 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
635 SetValue(CellVerticalAlignmentProperty, value);
636 NotifyPropertyChanged();
641 /// The left focusable view.<br />
642 /// This will return null if not set.<br />
643 /// This will also return null if the specified left focusable view is not on a window.<br />
645 /// <since_tizen> 3 </since_tizen>
646 public View LeftFocusableView
648 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
651 return (View)GetValue(LeftFocusableViewProperty);
655 SetValue(LeftFocusableViewProperty, value);
656 NotifyPropertyChanged();
661 /// The right focusable view.<br />
662 /// This will return null if not set.<br />
663 /// This will also return null if the specified right focusable view is not on a window.<br />
665 /// <since_tizen> 3 </since_tizen>
666 public View RightFocusableView
668 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
671 return (View)GetValue(RightFocusableViewProperty);
675 SetValue(RightFocusableViewProperty, value);
676 NotifyPropertyChanged();
681 /// The up focusable view.<br />
682 /// This will return null if not set.<br />
683 /// This will also return null if the specified up focusable view is not on a window.<br />
685 /// <since_tizen> 3 </since_tizen>
686 public View UpFocusableView
688 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
691 return (View)GetValue(UpFocusableViewProperty);
695 SetValue(UpFocusableViewProperty, value);
696 NotifyPropertyChanged();
701 /// The down focusable view.<br />
702 /// This will return null if not set.<br />
703 /// This will also return null if the specified down focusable view is not on a window.<br />
705 /// <since_tizen> 3 </since_tizen>
706 public View DownFocusableView
708 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
711 return (View)GetValue(DownFocusableViewProperty);
715 SetValue(DownFocusableViewProperty, value);
716 NotifyPropertyChanged();
721 /// Whether the view should be focusable by keyboard navigation.
723 /// <since_tizen> 3 </since_tizen>
724 public bool Focusable
728 SetValue(FocusableProperty, value);
729 NotifyPropertyChanged();
733 return (bool)GetValue(FocusableProperty);
738 /// Retrieves the position of the view.<br />
739 /// The coordinates are relative to the view's parent.<br />
741 /// <since_tizen> 3 </since_tizen>
742 public Position CurrentPosition
746 return GetCurrentPosition();
751 /// Sets the size of a view for the width and the height.<br />
752 /// Geometry can be scaled to fit within this area.<br />
753 /// This does not interfere with the view's scale factor.<br />
754 /// The views default depth is the minimum of width and height.<br />
757 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
758 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
760 /// <since_tizen> 3 </since_tizen>
765 Size2D temp = (Size2D)GetValue(Size2DProperty);
767 if (this.Layout == null)
769 if (temp.Width < 0) { temp.Width = 0; }
770 if (temp.Height < 0) { temp.Height = 0; }
773 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
777 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
778 SetValue(Size2DProperty, value);
779 // Set Specification so when layouts measure this View it matches the value set here.
780 // All Views are currently Layouts.
781 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
782 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
783 _widthPolicy = value.Width;
784 _heightPolicy = value.Height;
785 _layout?.RequestLayout();
786 NotifyPropertyChanged();
791 /// Retrieves the size of the view.<br />
792 /// The coordinates are relative to the view's parent.<br />
794 /// <since_tizen> 3 </since_tizen>
795 public Size2D CurrentSize
799 return GetCurrentSize();
804 /// Retrieves and sets the view's opacity.<br />
806 /// <since_tizen> 3 </since_tizen>
811 return (float)GetValue(OpacityProperty);
815 SetValue(OpacityProperty, value);
816 selectorData?.Opacity.UpdateIfNeeds(this, value);
817 NotifyPropertyChanged();
822 /// Sets the position of the view for X and Y.<br />
823 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
824 /// If the position inheritance is disabled, sets the world position.<br />
827 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
828 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
830 /// <since_tizen> 3 </since_tizen>
831 public Position2D Position2D
835 Position2D temp = (Position2D)GetValue(Position2DProperty);
836 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
840 SetValue(Position2DProperty, value);
841 NotifyPropertyChanged();
846 /// Retrieves the screen postion of the view.<br />
848 /// <since_tizen> 3 </since_tizen>
849 public Vector2 ScreenPosition
853 Vector2 temp = new Vector2(0.0f, 0.0f);
854 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
860 /// Determines whether the pivot point should be used to determine the position of the view.
861 /// This is false by default.
863 /// <remarks>If false, then the top-left of the view is used for the position.
864 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
866 /// <since_tizen> 3 </since_tizen>
867 public bool PositionUsesPivotPoint
871 return (bool)GetValue(PositionUsesPivotPointProperty);
875 SetValue(PositionUsesPivotPointProperty, value);
876 NotifyPropertyChanged();
881 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
883 /// <since_tizen> 3 </since_tizen>
884 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
886 "View view = new View(); " +
887 "view.PivotPoint = PivotPoint.Center; " +
888 "view.PositionUsesPivotPoint = true;" +
889 " Deprecated in API5: Will be removed in API8")]
890 [EditorBrowsable(EditorBrowsableState.Never)]
891 public bool PositionUsesAnchorPoint
896 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
901 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
902 NotifyPropertyChanged();
907 /// Queries whether the view is connected to the stage.<br />
908 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
910 /// <since_tizen> 3 </since_tizen>
911 public bool IsOnWindow
920 /// Gets the depth in the hierarchy for the view.
922 /// <since_tizen> 3 </since_tizen>
923 public int HierarchyDepth
927 return GetHierarchyDepth();
932 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
935 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
936 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
937 /// The values set by this property will likely change.
939 /// <since_tizen> 3 </since_tizen>
940 public int SiblingOrder
944 return (int)GetValue(SiblingOrderProperty);
948 SetValue(SiblingOrderProperty, value);
950 LayoutGroup layout = Layout as LayoutGroup;
951 layout?.ChangeLayoutSiblingOrder(value);
953 NotifyPropertyChanged();
958 /// Returns the natural size of the view.
961 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
963 /// <since_tizen> 5 </since_tizen>
964 public Vector3 NaturalSize
968 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
969 if (NDalicPINVOKE.SWIGPendingException.Pending)
970 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
976 /// Returns the natural size (Size2D) of the view.
979 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
981 /// <since_tizen> 4 </since_tizen>
982 public Size2D NaturalSize2D
986 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
987 if (NDalicPINVOKE.SWIGPendingException.Pending)
988 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
990 return new Size2D((int)temp.Width, (int)temp.Height);
995 /// Gets or sets the origin of a view within its parent's area.<br />
996 /// 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 />
997 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
998 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1000 /// <pre>The view has been initialized.</pre>
1001 /// <since_tizen> 3 </since_tizen>
1002 public Position ParentOrigin
1006 Position tmp = (Position)GetValue(ParentOriginProperty);
1007 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1011 SetValue(ParentOriginProperty, value);
1012 NotifyPropertyChanged();
1017 /// Gets or sets the anchor-point of a view.<br />
1018 /// 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 />
1019 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1020 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1021 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1022 /// <pre>The view has been initialized.</pre>
1025 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1027 /// <since_tizen> 3 </since_tizen>
1028 public Position PivotPoint
1032 Position tmp = (Position)GetValue(PivotPointProperty);
1033 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1037 SetValue(PivotPointProperty, value);
1038 NotifyPropertyChanged();
1043 /// Gets or sets the size width of the view.
1047 /// Animatable - This property can be animated using <c>Animation</c> class.
1050 /// <since_tizen> 3 </since_tizen>
1051 public float SizeWidth
1055 return (float)GetValue(SizeWidthProperty);
1059 SetValue(SizeWidthProperty, value);
1060 NotifyPropertyChanged();
1065 /// Gets or sets the size height of the view.
1069 /// Animatable - This property can be animated using <c>Animation</c> class.
1072 /// <since_tizen> 3 </since_tizen>
1073 public float SizeHeight
1077 return (float)GetValue(SizeHeightProperty);
1081 SetValue(SizeHeightProperty, value);
1082 NotifyPropertyChanged();
1087 /// Gets or sets the position of the view.<br />
1088 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1089 /// If the position inheritance is disabled, sets the world position.<br />
1093 /// Animatable - This property can be animated using <c>Animation</c> class.
1095 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1097 /// <since_tizen> 3 </since_tizen>
1098 public Position Position
1102 Position tmp = (Position)GetValue(PositionProperty);
1103 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1107 SetValue(PositionProperty, value);
1108 NotifyPropertyChanged();
1113 /// Gets or sets the position X of the view.
1117 /// Animatable - This property can be animated using <c>Animation</c> class.
1120 /// <since_tizen> 3 </since_tizen>
1121 public float PositionX
1125 return (float)GetValue(PositionXProperty);
1129 SetValue(PositionXProperty, value);
1130 NotifyPropertyChanged();
1135 /// Gets or sets the position Y of the view.
1139 /// Animatable - This property can be animated using <c>Animation</c> class.
1142 /// <since_tizen> 3 </since_tizen>
1143 public float PositionY
1147 return (float)GetValue(PositionYProperty);
1151 SetValue(PositionYProperty, value);
1152 NotifyPropertyChanged();
1157 /// Gets or sets the position Z of the view.
1161 /// Animatable - This property can be animated using <c>Animation</c> class.
1164 /// <since_tizen> 3 </since_tizen>
1165 public float PositionZ
1169 return (float)GetValue(PositionZProperty);
1173 SetValue(PositionZProperty, value);
1174 NotifyPropertyChanged();
1179 /// Gets or sets the world position of the view.
1181 /// <since_tizen> 3 </since_tizen>
1182 public Vector3 WorldPosition
1186 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1187 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1193 /// Gets or sets the orientation of the view.<br />
1194 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1198 /// This is an asynchronous method.
1201 /// Animatable - This property can be animated using <c>Animation</c> class.
1204 /// <since_tizen> 3 </since_tizen>
1205 public Rotation Orientation
1209 return (Rotation)GetValue(OrientationProperty);
1213 SetValue(OrientationProperty, value);
1214 NotifyPropertyChanged();
1219 /// Gets or sets the world orientation of the view.<br />
1221 /// <since_tizen> 3 </since_tizen>
1222 public Rotation WorldOrientation
1226 Rotation temp = new Rotation();
1227 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1233 /// Gets or sets the scale factor applied to the view.<br />
1237 /// Animatable - This property can be animated using <c>Animation</c> class.
1239 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1241 /// <since_tizen> 3 </since_tizen>
1242 public Vector3 Scale
1246 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1247 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1251 SetValue(ScaleProperty, value);
1252 NotifyPropertyChanged();
1257 /// Gets or sets the scale X factor applied to the view.
1261 /// Animatable - This property can be animated using <c>Animation</c> class.
1264 /// <since_tizen> 3 </since_tizen>
1269 return (float)GetValue(ScaleXProperty);
1273 SetValue(ScaleXProperty, value);
1274 NotifyPropertyChanged();
1279 /// Gets or sets the scale Y factor applied to the view.
1283 /// Animatable - This property can be animated using <c>Animation</c> class.
1286 /// <since_tizen> 3 </since_tizen>
1291 return (float)GetValue(ScaleYProperty);
1295 SetValue(ScaleYProperty, value);
1296 NotifyPropertyChanged();
1301 /// Gets or sets the scale Z factor applied to the view.
1305 /// Animatable - This property can be animated using <c>Animation</c> class.
1308 /// <since_tizen> 3 </since_tizen>
1313 return (float)GetValue(ScaleZProperty);
1317 SetValue(ScaleZProperty, value);
1318 NotifyPropertyChanged();
1323 /// Gets the world scale of the view.
1325 /// <since_tizen> 3 </since_tizen>
1326 public Vector3 WorldScale
1330 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1331 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1337 /// Retrieves the visibility flag of the view.
1341 /// If the view is not visible, then the view and its children will not be rendered.
1342 /// 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.
1345 /// Animatable - This property can be animated using <c>Animation</c> class.
1348 /// <since_tizen> 3 </since_tizen>
1349 public bool Visibility
1354 GetProperty(View.Property.VISIBLE).Get(out temp);
1360 /// Gets the view's world color.
1362 /// <since_tizen> 3 </since_tizen>
1363 public Vector4 WorldColor
1367 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1368 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1374 /// Gets or sets the view's name.
1376 /// <since_tizen> 3 </since_tizen>
1381 return (string)GetValue(NameProperty);
1385 SetValue(NameProperty, value);
1386 NotifyPropertyChanged();
1391 /// Get the number of children held by the view.
1393 /// <since_tizen> 3 </since_tizen>
1394 public new uint ChildCount
1398 return GetChildCount();
1403 /// Gets the view's ID.
1406 /// <since_tizen> 3 </since_tizen>
1416 /// Gets or sets the status of whether the view should emit touch or hover signals.
1418 /// <since_tizen> 3 </since_tizen>
1419 public bool Sensitive
1423 return (bool)GetValue(SensitiveProperty);
1427 SetValue(SensitiveProperty, value);
1428 NotifyPropertyChanged();
1433 /// 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.
1435 /// <since_tizen> 3 </since_tizen>
1436 public bool LeaveRequired
1440 return (bool)GetValue(LeaveRequiredProperty);
1444 SetValue(LeaveRequiredProperty, value);
1445 NotifyPropertyChanged();
1450 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1452 /// <since_tizen> 3 </since_tizen>
1453 public bool InheritOrientation
1457 return (bool)GetValue(InheritOrientationProperty);
1461 SetValue(InheritOrientationProperty, value);
1462 NotifyPropertyChanged();
1467 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1469 /// <since_tizen> 3 </since_tizen>
1470 public bool InheritScale
1474 return (bool)GetValue(InheritScaleProperty);
1478 SetValue(InheritScaleProperty, value);
1479 NotifyPropertyChanged();
1484 /// Gets or sets the status of how the view and its children should be drawn.<br />
1485 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1486 /// 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 />
1487 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1488 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1489 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1491 /// <since_tizen> 3 </since_tizen>
1492 public DrawModeType DrawMode
1496 return (DrawModeType)GetValue(DrawModeProperty);
1500 SetValue(DrawModeProperty, value);
1501 NotifyPropertyChanged();
1506 /// Gets or sets the relative to parent size factor of the view.<br />
1507 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1508 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1511 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1513 /// <since_tizen> 3 </since_tizen>
1514 public Vector3 SizeModeFactor
1518 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1519 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1523 SetValue(SizeModeFactorProperty, value);
1524 NotifyPropertyChanged();
1529 /// Gets or sets the width resize policy to be used.
1531 /// <since_tizen> 3 </since_tizen>
1532 public ResizePolicyType WidthResizePolicy
1536 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1540 SetValue(WidthResizePolicyProperty, value);
1541 NotifyPropertyChanged();
1546 /// Gets or sets the height resize policy to be used.
1548 /// <since_tizen> 3 </since_tizen>
1549 public ResizePolicyType HeightResizePolicy
1553 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1557 SetValue(HeightResizePolicyProperty, value);
1558 NotifyPropertyChanged();
1563 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1564 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1566 /// <since_tizen> 3 </since_tizen>
1567 public SizeScalePolicyType SizeScalePolicy
1571 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1575 SetValue(SizeScalePolicyProperty, value);
1576 NotifyPropertyChanged();
1581 /// Gets or sets the status of whether the width size is dependent on the height size.
1583 /// <since_tizen> 3 </since_tizen>
1584 public bool WidthForHeight
1588 return (bool)GetValue(WidthForHeightProperty);
1592 SetValue(WidthForHeightProperty, value);
1593 NotifyPropertyChanged();
1598 /// Gets or sets the status of whether the height size is dependent on the width size.
1600 /// <since_tizen> 3 </since_tizen>
1601 public bool HeightForWidth
1605 return (bool)GetValue(HeightForWidthProperty);
1609 SetValue(HeightForWidthProperty, value);
1610 NotifyPropertyChanged();
1615 /// Gets or sets the padding for use in layout.
1618 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1620 /// <since_tizen> 5 </since_tizen>
1621 public Extents Padding
1625 // If View has a Layout then padding in stored in the base Layout class
1628 return Layout.Padding;
1632 Extents temp = (Extents)GetValue(PaddingProperty);
1633 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1635 // Two return points to prevent creating a zeroed Extent native object before assignment
1639 Extents padding = value;
1642 // Layout set so store Padding in LayoutItem instead of in View.
1643 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1644 // the position and sizes measure in the Layouting.
1645 Layout.Padding = value;
1646 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1647 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1648 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1650 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1654 SetValue(PaddingProperty, padding);
1655 NotifyPropertyChanged();
1660 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1663 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1665 /// <since_tizen> 3 </since_tizen>
1666 public Size2D MinimumSize
1670 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1671 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1675 if (_layout != null)
1677 // Note: it only works if minimum size is >= than natural size.
1678 // To force the size it should be done through the width&height spec or Size2D.
1679 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1680 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1681 _layout.RequestLayout();
1683 SetValue(MinimumSizeProperty, value);
1684 NotifyPropertyChanged();
1689 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1692 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1694 /// <since_tizen> 3 </since_tizen>
1695 public Size2D MaximumSize
1699 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1700 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1704 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1705 // MATCH_PARENT spec + parent container size can be used to limit
1706 if (_layout != null)
1708 _layout.RequestLayout();
1710 SetValue(MaximumSizeProperty, value);
1711 NotifyPropertyChanged();
1716 /// Gets or sets whether a child view inherits it's parent's position.<br />
1717 /// Default is to inherit.<br />
1718 /// 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 />
1720 /// <since_tizen> 3 </since_tizen>
1721 public bool InheritPosition
1725 return (bool)GetValue(InheritPositionProperty);
1729 SetValue(InheritPositionProperty, value);
1730 NotifyPropertyChanged();
1735 /// Gets or sets the clipping behavior (mode) of it's children.
1737 /// <since_tizen> 3 </since_tizen>
1738 public ClippingModeType ClippingMode
1742 return (ClippingModeType)GetValue(ClippingModeProperty);
1746 SetValue(ClippingModeProperty, value);
1747 NotifyPropertyChanged();
1752 /// Gets the number of renderers held by the view.
1754 /// <since_tizen> 3 </since_tizen>
1755 public uint RendererCount
1759 return GetRendererCount();
1764 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1767 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1769 /// <since_tizen> 3 </since_tizen>
1770 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1772 "View view = new View(); " +
1773 "view.PivotPoint = PivotPoint.Center; " +
1774 "view.PositionUsesPivotPoint = true;")]
1775 [EditorBrowsable(EditorBrowsableState.Never)]
1776 public Position AnchorPoint
1780 Position temp = new Position(0.0f, 0.0f, 0.0f);
1781 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1782 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1786 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1787 NotifyPropertyChanged();
1792 /// Sets the size of a view for the width, the height and the depth.<br />
1793 /// Geometry can be scaled to fit within this area.<br />
1794 /// This does not interfere with the view's scale factor.<br />
1795 /// The views default depth is the minimum of width and height.<br />
1799 /// Animatable - This property can be animated using <c>Animation</c> class.
1801 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1803 /// <since_tizen> 5 </since_tizen>
1808 Size tmp = (Size)GetValue(SizeProperty);
1809 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1813 SetValue(SizeProperty, value);
1814 NotifyPropertyChanged();
1819 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1821 /// <since_tizen> 3 </since_tizen>
1822 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1824 "Container parent = view.GetParent(); " +
1825 "View view = parent as View;")]
1826 [EditorBrowsable(EditorBrowsableState.Never)]
1827 public new View Parent
1832 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1833 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1834 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1836 if (basehandle is Layer layer)
1838 ret = new View(Layer.getCPtr(layer).Handle, false);
1839 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1843 ret = basehandle as View;
1846 Interop.BaseHandle.delete_BaseHandle(CPtr);
1847 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1849 if (NDalicPINVOKE.SWIGPendingException.Pending)
1850 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1856 /// Gets/Sets whether inherit parent's the layout Direction.
1858 /// <since_tizen> 4 </since_tizen>
1859 public bool InheritLayoutDirection
1863 return (bool)GetValue(InheritLayoutDirectionProperty);
1867 SetValue(InheritLayoutDirectionProperty, value);
1868 NotifyPropertyChanged();
1873 /// Gets/Sets the layout Direction.
1875 /// <since_tizen> 4 </since_tizen>
1876 public ViewLayoutDirectionType LayoutDirection
1880 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1884 SetValue(LayoutDirectionProperty, value);
1885 NotifyPropertyChanged();
1886 _layout?.RequestLayout();
1891 /// Gets or sets the Margin for use in layout.
1894 /// Margin property is supported by Layout algorithms and containers.
1895 /// Please Set Layout if you want to use Margin property.
1896 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1898 /// <since_tizen> 4 </since_tizen>
1899 public Extents Margin
1903 // If View has a Layout then margin is stored in Layout.
1906 return Layout.Margin;
1910 // If Layout not set then return margin stored in View.
1911 Extents temp = (Extents)GetValue(MarginProperty);
1912 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1914 // Two return points to prevent creating a zeroed Extent native object before assignment
1920 // Layout set so store Margin in LayoutItem instead of View.
1921 // If View stores the Margin too then the Legacy Size Negotiation will
1922 // overwrite the position and size values measured in the Layouting.
1923 Layout.Margin = value;
1924 SetValue(MarginProperty, new Extents(0,0,0,0));
1925 _layout?.RequestLayout();
1929 SetValue(MarginProperty, value);
1931 NotifyPropertyChanged();
1932 _layout?.RequestLayout();
1937 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1939 /// <since_tizen> 6 </since_tizen>
1940 public int WidthSpecification
1944 return _widthPolicy;
1948 _widthPolicy = value;
1949 if( _oldWidthPolicy != _widthPolicy )
1951 if (_widthPolicy >= 0)
1953 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1955 if(_heightPolicy>=0) // Policy an exact value
1957 Size2D.Width = _widthPolicy;
1961 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1962 // Size2D height will store the specification value (negative number) this will then be applied to the
1963 // HeightSpecification when the Size2D callback is invoked.
1964 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1967 _layout?.RequestLayout();
1968 _oldWidthPolicy = _widthPolicy;
1974 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1976 /// <since_tizen> 6 </since_tizen>
1977 public int HeightSpecification
1981 return _heightPolicy;
1985 _heightPolicy = value;
1986 if( _oldHeightPolicy != _heightPolicy )
1988 if (_heightPolicy >= 0)
1990 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1992 if(_widthPolicy>=0) // Policy an exact value
1994 Size2D.Height = _heightPolicy;
1998 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1999 // Size2D height will store the specification value (negative number) this will then be applied to the
2000 // HeightSpecification when the Size2D callback is invoked.
2001 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2005 _layout?.RequestLayout();
2006 _oldHeightPolicy = _heightPolicy;
2012 /// Gets the List of transitions for this View.
2014 /// <since_tizen> 6 </since_tizen>
2015 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2019 if (_layoutTransitions == null)
2021 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2023 return _layoutTransitions;
2028 /// Set a layout transitions for this View.
2031 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2033 /// <since_tizen> 6 </since_tizen>
2034 public LayoutTransition LayoutTransition
2038 if (_layoutTransitions == null)
2040 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2042 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2044 AttachTransitionsToChildren(value);
2049 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2052 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2054 /// <since_tizen> 4 </since_tizen>
2055 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2056 [EditorBrowsable(EditorBrowsableState.Never)]
2057 public Extents PaddingEX
2061 Extents temp = new Extents(0, 0, 0, 0);
2062 GetProperty(View.Property.PADDING).Get(temp);
2063 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2067 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2068 NotifyPropertyChanged();
2069 _layout?.RequestLayout();
2073 /// <since_tizen> 6 </since_tizen>
2074 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2075 [EditorBrowsable(EditorBrowsableState.Never)]
2076 public Style XamlStyle
2080 return (Style)GetValue(XamlStyleProperty);
2084 SetValue(XamlStyleProperty, value);
2089 /// The Color of View. This is an RGBA value.
2093 /// Animatable - This property can be animated using <c>Animation</c> class.
2095 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2097 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2098 [EditorBrowsable(EditorBrowsableState.Never)]
2103 Color temp = (Color)GetValue(ColorProperty);
2104 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2108 SetValue(ColorProperty, value);
2109 selectorData?.Color.UpdateIfNeeds(this, value);
2110 NotifyPropertyChanged();
2115 /// Set the layout on this View. Replaces any existing Layout.
2117 /// <since_tizen> 6 </since_tizen>
2118 public LayoutItem Layout
2126 // Do nothing if layout provided is already set on this View.
2127 if (value == _layout)
2132 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2133 layoutingDisabled = false;
2136 // If new layout being set already has a owner then that owner receives a replacement default layout.
2137 // First check if the layout to be set already has a owner.
2138 if (value?.Owner != null)
2140 // Previous owner of the layout gets a default layout as a replacement.
2141 value.Owner.Layout = new AbsoluteLayout();
2143 // Copy Margin and Padding to replacement LayoutGroup.
2144 if (value.Owner.Layout != null)
2146 value.Owner.Layout.Margin = value.Margin;
2147 value.Owner.Layout.Padding = value.Padding;
2151 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2152 // View if no replacement. Previously margin and padding values would have been moved from
2153 // the View to the layout.
2154 if (_layout != null ) // Existing layout
2158 // Existing layout being replaced so copy over margin and padding values.
2159 value.Margin = _layout.Margin;
2160 value.Padding = _layout.Padding;
2164 // Layout not being replaced so restore margin and padding to View.
2165 SetValue(MarginProperty, _layout.Margin);
2166 SetValue(PaddingProperty, _layout.Padding);
2167 NotifyPropertyChanged();
2172 // First Layout to be added to the View hence copy
2174 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2177 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2179 // If View already has a margin set then store it in Layout instead.
2180 value.Margin = Margin;
2181 SetValue(MarginProperty, new Extents(0,0,0,0));
2182 NotifyPropertyChanged();
2185 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2187 // If View already has a padding set then store it in Layout instead.
2188 value.Padding = Padding;
2189 SetValue(PaddingProperty, new Extents(0,0,0,0));
2190 NotifyPropertyChanged();
2195 // Remove existing layout from it's parent layout group.
2196 _layout?.Unparent();
2198 // Set layout to this view
2204 /// The weight of the View, used to share available space in a layout with siblings.
2206 /// <since_tizen> 6 </since_tizen>
2216 _layout?.RequestLayout();
2221 /// Whether to load the BackgroundImage synchronously.
2222 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2223 /// Note: For Normal Quad images only.
2225 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2226 [EditorBrowsable(EditorBrowsableState.Never)]
2227 public bool BackgroundImageSynchronosLoading
2231 return _backgroundImageSynchronosLoading;
2235 _backgroundImageSynchronosLoading = value;
2237 string bgUrl = null;
2238 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2240 if (!string.IsNullOrEmpty(bgUrl))
2242 PropertyMap bgMap = this.Background;
2243 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2249 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2250 [EditorBrowsable(EditorBrowsableState.Never)]
2251 public Vector2 UpdateSizeHint
2255 return (Vector2)GetValue(UpdateSizeHintProperty);
2259 SetValue(UpdateSizeHintProperty, value);
2260 NotifyPropertyChanged();
2264 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2265 [EditorBrowsable(EditorBrowsableState.Never)]
2266 public string[] TransitionNames
2270 return transitionNames;
2274 transitionNames = value;
2280 /// Enable/Disable ControlState propagation for children.
2281 /// It is false by default.
2282 /// If the View needs to share ControlState with descendants, please set it true.
2283 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2285 [EditorBrowsable(EditorBrowsableState.Never)]
2286 public bool EnableControlStatePropagation
2288 get => controlStatePropagation;
2291 controlStatePropagation = value;
2293 foreach (View child in Children)
2295 child.EnableControlStatePropagation = value;
2301 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2302 /// By default, it is false in View, true in Control.
2303 /// Note that if the value is true, the View will be a touch receptor.
2305 [EditorBrowsable(EditorBrowsableState.Never)]
2306 public bool EnableControlState
2310 return (bool)GetValue(EnableControlStateProperty);
2314 SetValue(EnableControlStateProperty, value);
2319 /// Whether the actor grab all touches even if touch leaves its boundary.
2321 /// <returns>true, if it grab all touch after start</returns>
2322 [EditorBrowsable(EditorBrowsableState.Never)]
2323 public bool GrabTouchAfterLeave
2328 GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp);
2333 SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value));
2334 NotifyPropertyChanged();
2339 /// Get Style, it is abstract function and must be override.
2341 /// <since_tizen> 6 </since_tizen>
2342 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2343 // TODO: It should be deprecated. please use CreateViewStyle instead.
2344 [EditorBrowsable(EditorBrowsableState.Never)]
2345 protected virtual ViewStyle GetViewStyle()
2347 return CreateViewStyle();
2351 /// Create Style, it is abstract function and must be override.
2353 [EditorBrowsable(EditorBrowsableState.Never)]
2354 protected virtual ViewStyle CreateViewStyle()
2356 return new ViewStyle();
2360 /// Called after the View's ControlStates changed.
2362 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2363 [EditorBrowsable(EditorBrowsableState.Never)]
2364 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2368 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2369 [EditorBrowsable(EditorBrowsableState.Never)]
2370 public virtual void ApplyStyle(ViewStyle viewStyle)
2372 if (null == viewStyle || this.viewStyle == viewStyle) return;
2374 this.viewStyle = viewStyle;
2376 Dictionary<string, BindableProperty> bindablePropertyOfView;
2377 Type viewType = GetType();
2379 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2380 Type styleType = viewStyle.GetType();
2382 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2383 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2385 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2387 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2389 BindableProperty viewProperty;
2390 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2392 if (null != viewProperty)
2394 object value = viewStyle.GetValue(keyValuePair.Value);
2398 SetValue(viewProperty, value);