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;
72 /// Return a copied Style instance of View.
75 /// It returns copied Style instance and changing it does not effect to the View.
77 [EditorBrowsable(EditorBrowsableState.Never)]
78 public ViewStyle Style => new ViewStyle(this);
80 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
81 [EditorBrowsable(EditorBrowsableState.Never)]
82 public ViewStyle ViewStyle
86 if (null == viewStyle)
88 ApplyStyle(GetViewStyle());
96 /// Creates a new instance of a view.
98 /// <since_tizen> 3 </since_tizen>
99 public View() : this(Interop.View.View_New(), true)
101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
105 [EditorBrowsable(EditorBrowsableState.Never)]
106 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
108 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
112 /// Create a new instance of a View with setting the status of shown or hidden.
114 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
115 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
116 [EditorBrowsable(EditorBrowsableState.Never)]
117 public View(bool shown) : this(Interop.View.View_New(), true)
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
125 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
134 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
136 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
139 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
143 PositionUsesPivotPoint = false;
146 _onWindowSendEventCallback = SendViewAddedEventToWindow;
147 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
155 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166 /// The event that is triggered when the View's ControlState is changed.
168 [EditorBrowsable(EditorBrowsableState.Never)]
169 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
171 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
173 private ControlState controlStates = ControlState.Normal;
175 /// Get/Set the control state.
177 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 public ControlState ControlState
183 return controlStates;
187 if (controlStates == value)
192 var prevState = controlStates;
194 controlStates = value;
196 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
198 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
200 OnControlStateChanged(changeInfo);
202 if (controlStatePropagation)
204 foreach (View child in Children)
206 child.ControlState = value;
210 ControlStateChangedEvent?.Invoke(this, changeInfo);
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 bool IsResourcesCreated
220 return Application.Current.IsResourcesCreated;
224 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
225 [EditorBrowsable(EditorBrowsableState.Never)]
226 public ResourceDictionary XamlResources
230 return Application.Current.XamlResources;
234 Application.Current.XamlResources = value;
239 /// The StyleName, type string.
241 /// <since_tizen> 3 </since_tizen>
242 public string StyleName
246 return (string)GetValue(StyleNameProperty);
250 SetValue(StyleNameProperty, value);
251 NotifyPropertyChanged();
256 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
259 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
261 /// <since_tizen> 3 </since_tizen>
262 public Color BackgroundColor
266 Color temp = (Color)GetValue(BackgroundColorProperty);
267 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
271 SetValue(BackgroundColorProperty, value);
272 if (selectorData != null)
274 selectorData.BackgroundImage.Reset(this);
275 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
277 NotifyPropertyChanged();
282 /// The mutually exclusive with "backgroundColor" and "background" type Map.
284 /// <since_tizen> 3 </since_tizen>
285 public string BackgroundImage
289 return (string)GetValue(BackgroundImageProperty);
293 SetValue(BackgroundImageProperty, value);
294 if (selectorData != null)
296 selectorData.BackgroundColor.Reset(this);
297 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
299 NotifyPropertyChanged();
304 /// Get or set the border of background image.
306 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
307 [EditorBrowsable(EditorBrowsableState.Never)]
308 public Rectangle BackgroundImageBorder
312 return (Rectangle)GetValue(BackgroundImageBorderProperty);
316 SetValue(BackgroundImageBorderProperty, value);
317 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
318 NotifyPropertyChanged();
323 /// The background of view.
325 /// <since_tizen> 3 </since_tizen>
326 public Tizen.NUI.PropertyMap Background
330 return (PropertyMap)GetValue(BackgroundProperty);
334 SetValue(BackgroundProperty, value);
335 NotifyPropertyChanged();
340 /// Describes a shadow as an image for a View.
341 /// It is null by default.
344 /// Getter returns copied instance of current shadow.
347 /// The mutually exclusive with "BoxShadow".
349 [EditorBrowsable(EditorBrowsableState.Never)]
350 public ImageShadow ImageShadow
354 return (ImageShadow)GetValue(ImageShadowProperty);
358 SetValue(ImageShadowProperty, value);
359 if (selectorData != null)
361 selectorData.BoxShadow.Reset(this);
362 selectorData.ImageShadow.UpdateIfNeeds(this, value);
364 NotifyPropertyChanged();
369 /// Describes a box shaped shadow drawing for a View.
370 /// It is null by default.
373 /// Gettter returns copied instance of current shadow.
376 /// The mutually exclusive with "ImageShadow".
378 [EditorBrowsable(EditorBrowsableState.Never)]
379 public Shadow BoxShadow
383 return (Shadow)GetValue(BoxShadowProperty);
387 SetValue(BoxShadowProperty, value);
388 if (selectorData != null)
390 selectorData.ImageShadow.Reset(this);
391 selectorData.BoxShadow.UpdateIfNeeds(this, value);
393 NotifyPropertyChanged();
398 /// The radius for the rounded corners of the View.
399 /// This will rounds background and shadow edges.
400 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
402 [EditorBrowsable(EditorBrowsableState.Never)]
403 public float CornerRadius
407 return (float)GetValue(CornerRadiusProperty);
411 SetValue(CornerRadiusProperty, value);
412 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
413 NotifyPropertyChanged();
418 /// The current state of the view.
420 /// <since_tizen> 3 </since_tizen>
425 return (States)GetValue(StateProperty);
429 SetValue(StateProperty, value);
430 NotifyPropertyChanged();
435 /// The current sub state of the view.
437 /// <since_tizen> 3 </since_tizen>
438 public States SubState
442 return (States)GetValue(SubStateProperty);
446 SetValue(SubStateProperty, value);
447 NotifyPropertyChanged();
452 /// Displays a tooltip
454 /// <since_tizen> 3 </since_tizen>
455 public Tizen.NUI.PropertyMap Tooltip
459 return (PropertyMap)GetValue(TooltipProperty);
463 SetValue(TooltipProperty, value);
464 NotifyPropertyChanged();
469 /// Displays a tooltip as a text.
471 /// <since_tizen> 3 </since_tizen>
472 public string TooltipText
476 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
477 NotifyPropertyChanged();
482 /// The Child property of FlexContainer.<br />
483 /// The proportion of the free space in the container, the flex item will receive.<br />
484 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
486 /// <since_tizen> 3 </since_tizen>
487 [Obsolete("Deprecated in API8, will be removed in API10.")]
492 return (float)GetValue(FlexProperty);
496 SetValue(FlexProperty, value);
497 NotifyPropertyChanged();
502 /// The Child property of FlexContainer.<br />
503 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
505 /// <since_tizen> 3 </since_tizen>
506 [Obsolete("Deprecated in API8, will be removed in API10.")]
511 return (int)GetValue(AlignSelfProperty);
515 SetValue(AlignSelfProperty, value);
516 NotifyPropertyChanged();
521 /// The Child property of FlexContainer.<br />
522 /// The space around the flex item.<br />
525 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
527 /// <since_tizen> 3 </since_tizen>
528 [Obsolete("Deprecated in API8, will be removed in API10.")]
529 public Vector4 FlexMargin
533 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
534 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
538 SetValue(FlexMarginProperty, value);
539 NotifyPropertyChanged();
544 /// The top-left cell this child occupies, if not set, the first available cell is used.
547 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
549 /// <since_tizen> 3 </since_tizen>
550 public Vector2 CellIndex
554 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
555 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
559 SetValue(CellIndexProperty, value);
560 NotifyPropertyChanged();
565 /// The number of rows this child occupies, if not set, the default value is 1.
567 /// <since_tizen> 3 </since_tizen>
572 return (float)GetValue(RowSpanProperty);
576 SetValue(RowSpanProperty, value);
577 NotifyPropertyChanged();
582 /// The number of columns this child occupies, if not set, the default value is 1.
584 /// <since_tizen> 3 </since_tizen>
585 public float ColumnSpan
589 return (float)GetValue(ColumnSpanProperty);
593 SetValue(ColumnSpanProperty, value);
594 NotifyPropertyChanged();
599 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
601 /// <since_tizen> 3 </since_tizen>
602 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
606 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
610 SetValue(CellHorizontalAlignmentProperty, value);
611 NotifyPropertyChanged();
616 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
618 /// <since_tizen> 3 </since_tizen>
619 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
623 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
627 SetValue(CellVerticalAlignmentProperty, value);
628 NotifyPropertyChanged();
633 /// The left focusable view.<br />
634 /// This will return null if not set.<br />
635 /// This will also return null if the specified left focusable view is not on a window.<br />
637 /// <since_tizen> 3 </since_tizen>
638 public View LeftFocusableView
640 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
643 return (View)GetValue(LeftFocusableViewProperty);
647 SetValue(LeftFocusableViewProperty, value);
648 NotifyPropertyChanged();
653 /// The right focusable view.<br />
654 /// This will return null if not set.<br />
655 /// This will also return null if the specified right focusable view is not on a window.<br />
657 /// <since_tizen> 3 </since_tizen>
658 public View RightFocusableView
660 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
663 return (View)GetValue(RightFocusableViewProperty);
667 SetValue(RightFocusableViewProperty, value);
668 NotifyPropertyChanged();
673 /// The up focusable view.<br />
674 /// This will return null if not set.<br />
675 /// This will also return null if the specified up focusable view is not on a window.<br />
677 /// <since_tizen> 3 </since_tizen>
678 public View UpFocusableView
680 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
683 return (View)GetValue(UpFocusableViewProperty);
687 SetValue(UpFocusableViewProperty, value);
688 NotifyPropertyChanged();
693 /// The down focusable view.<br />
694 /// This will return null if not set.<br />
695 /// This will also return null if the specified down focusable view is not on a window.<br />
697 /// <since_tizen> 3 </since_tizen>
698 public View DownFocusableView
700 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
703 return (View)GetValue(DownFocusableViewProperty);
707 SetValue(DownFocusableViewProperty, value);
708 NotifyPropertyChanged();
713 /// Whether the view should be focusable by keyboard navigation.
715 /// <since_tizen> 3 </since_tizen>
716 public bool Focusable
720 SetValue(FocusableProperty, value);
721 NotifyPropertyChanged();
725 return (bool)GetValue(FocusableProperty);
730 /// Retrieves the position of the view.<br />
731 /// The coordinates are relative to the view's parent.<br />
733 /// <since_tizen> 3 </since_tizen>
734 public Position CurrentPosition
738 return GetCurrentPosition();
743 /// Sets the size of a view for the width and the height.<br />
744 /// Geometry can be scaled to fit within this area.<br />
745 /// This does not interfere with the view's scale factor.<br />
746 /// The views default depth is the minimum of width and height.<br />
749 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
750 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
752 /// <since_tizen> 3 </since_tizen>
757 Size2D temp = (Size2D)GetValue(Size2DProperty);
758 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
762 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
763 SetValue(Size2DProperty, value);
764 // Set Specification so when layouts measure this View it matches the value set here.
765 // All Views are currently Layouts.
766 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
767 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
768 _widthPolicy = value.Width;
769 _heightPolicy = value.Height;
770 _layout?.RequestLayout();
771 NotifyPropertyChanged();
776 /// Retrieves the size of the view.<br />
777 /// The coordinates are relative to the view's parent.<br />
779 /// <since_tizen> 3 </since_tizen>
780 public Size2D CurrentSize
784 return GetCurrentSize();
789 /// Retrieves and sets the view's opacity.<br />
791 /// <since_tizen> 3 </since_tizen>
796 return (float)GetValue(OpacityProperty);
800 SetValue(OpacityProperty, value);
801 selectorData?.Opacity.UpdateIfNeeds(this, value);
802 NotifyPropertyChanged();
807 /// Sets the position of the view for X and Y.<br />
808 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
809 /// If the position inheritance is disabled, sets the world position.<br />
812 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
813 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
815 /// <since_tizen> 3 </since_tizen>
816 public Position2D Position2D
820 Position2D temp = (Position2D)GetValue(Position2DProperty);
821 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
825 SetValue(Position2DProperty, value);
826 NotifyPropertyChanged();
831 /// Retrieves the screen postion of the view.<br />
833 /// <since_tizen> 3 </since_tizen>
834 public Vector2 ScreenPosition
838 Vector2 temp = new Vector2(0.0f, 0.0f);
839 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
845 /// Determines whether the pivot point should be used to determine the position of the view.
846 /// This is false by default.
848 /// <remarks>If false, then the top-left of the view is used for the position.
849 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
851 /// <since_tizen> 3 </since_tizen>
852 public bool PositionUsesPivotPoint
856 return (bool)GetValue(PositionUsesPivotPointProperty);
860 SetValue(PositionUsesPivotPointProperty, value);
861 NotifyPropertyChanged();
866 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
868 /// <since_tizen> 3 </since_tizen>
869 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
871 "View view = new View(); " +
872 "view.PivotPoint = PivotPoint.Center; " +
873 "view.PositionUsesPivotPoint = true;" +
874 " Deprecated in API5: Will be removed in API8")]
875 [EditorBrowsable(EditorBrowsableState.Never)]
876 public bool PositionUsesAnchorPoint
881 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
886 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
887 NotifyPropertyChanged();
892 /// Queries whether the view is connected to the stage.<br />
893 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
895 /// <since_tizen> 3 </since_tizen>
896 public bool IsOnWindow
905 /// Gets the depth in the hierarchy for the view.
907 /// <since_tizen> 3 </since_tizen>
908 public int HierarchyDepth
912 return GetHierarchyDepth();
917 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
920 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
921 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
922 /// The values set by this property will likely change.
924 /// <since_tizen> 3 </since_tizen>
925 public int SiblingOrder
929 return (int)GetValue(SiblingOrderProperty);
933 SetValue(SiblingOrderProperty, value);
935 LayoutGroup layout = Layout as LayoutGroup;
936 layout?.ChangeLayoutSiblingOrder(value);
938 NotifyPropertyChanged();
943 /// Returns the natural size of the view.
946 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
948 /// <since_tizen> 5 </since_tizen>
949 public Vector3 NaturalSize
953 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
954 if (NDalicPINVOKE.SWIGPendingException.Pending)
955 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
961 /// Returns the natural size (Size2D) of the view.
964 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
966 /// <since_tizen> 4 </since_tizen>
967 public Size2D NaturalSize2D
971 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
972 if (NDalicPINVOKE.SWIGPendingException.Pending)
973 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
975 return new Size2D((int)temp.Width, (int)temp.Height);
980 /// Gets or sets the origin of a view within its parent's area.<br />
981 /// 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 />
982 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
983 /// A view's position is the distance between this origin and the view's anchor-point.<br />
985 /// <pre>The view has been initialized.</pre>
986 /// <since_tizen> 3 </since_tizen>
987 public Position ParentOrigin
991 Position tmp = (Position)GetValue(ParentOriginProperty);
992 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
996 SetValue(ParentOriginProperty, value);
997 NotifyPropertyChanged();
1002 /// Gets or sets the anchor-point of a view.<br />
1003 /// 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 />
1004 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1005 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1006 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1007 /// <pre>The view has been initialized.</pre>
1010 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1012 /// <since_tizen> 3 </since_tizen>
1013 public Position PivotPoint
1017 Position tmp = (Position)GetValue(PivotPointProperty);
1018 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1022 SetValue(PivotPointProperty, value);
1023 NotifyPropertyChanged();
1028 /// Gets or sets the size width of the view.
1032 /// Animatable - This property can be animated using <c>Animation</c> class.
1035 /// <since_tizen> 3 </since_tizen>
1036 public float SizeWidth
1040 return (float)GetValue(SizeWidthProperty);
1044 SetValue(SizeWidthProperty, value);
1045 NotifyPropertyChanged();
1050 /// Gets or sets the size height of the view.
1054 /// Animatable - This property can be animated using <c>Animation</c> class.
1057 /// <since_tizen> 3 </since_tizen>
1058 public float SizeHeight
1062 return (float)GetValue(SizeHeightProperty);
1066 SetValue(SizeHeightProperty, value);
1067 NotifyPropertyChanged();
1072 /// Gets or sets the position of the view.<br />
1073 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1074 /// If the position inheritance is disabled, sets the world position.<br />
1078 /// Animatable - This property can be animated using <c>Animation</c> class.
1080 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1082 /// <since_tizen> 3 </since_tizen>
1083 public Position Position
1087 Position tmp = (Position)GetValue(PositionProperty);
1088 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1092 SetValue(PositionProperty, value);
1093 NotifyPropertyChanged();
1098 /// Gets or sets the position X of the view.
1102 /// Animatable - This property can be animated using <c>Animation</c> class.
1105 /// <since_tizen> 3 </since_tizen>
1106 public float PositionX
1110 return (float)GetValue(PositionXProperty);
1114 SetValue(PositionXProperty, value);
1115 NotifyPropertyChanged();
1120 /// Gets or sets the position Y of the view.
1124 /// Animatable - This property can be animated using <c>Animation</c> class.
1127 /// <since_tizen> 3 </since_tizen>
1128 public float PositionY
1132 return (float)GetValue(PositionYProperty);
1136 SetValue(PositionYProperty, value);
1137 NotifyPropertyChanged();
1142 /// Gets or sets the position Z of the view.
1146 /// Animatable - This property can be animated using <c>Animation</c> class.
1149 /// <since_tizen> 3 </since_tizen>
1150 public float PositionZ
1154 return (float)GetValue(PositionZProperty);
1158 SetValue(PositionZProperty, value);
1159 NotifyPropertyChanged();
1164 /// Gets or sets the world position of the view.
1166 /// <since_tizen> 3 </since_tizen>
1167 public Vector3 WorldPosition
1171 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1172 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1178 /// Gets or sets the orientation of the view.<br />
1179 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1183 /// This is an asynchronous method.
1186 /// Animatable - This property can be animated using <c>Animation</c> class.
1189 /// <since_tizen> 3 </since_tizen>
1190 public Rotation Orientation
1194 return (Rotation)GetValue(OrientationProperty);
1198 SetValue(OrientationProperty, value);
1199 NotifyPropertyChanged();
1204 /// Gets or sets the world orientation of the view.<br />
1206 /// <since_tizen> 3 </since_tizen>
1207 public Rotation WorldOrientation
1211 Rotation temp = new Rotation();
1212 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1218 /// Gets or sets the scale factor applied to the view.<br />
1222 /// Animatable - This property can be animated using <c>Animation</c> class.
1224 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1226 /// <since_tizen> 3 </since_tizen>
1227 public Vector3 Scale
1231 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1232 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1236 SetValue(ScaleProperty, value);
1237 NotifyPropertyChanged();
1242 /// Gets or sets the scale X factor applied to the view.
1246 /// Animatable - This property can be animated using <c>Animation</c> class.
1249 /// <since_tizen> 3 </since_tizen>
1254 return (float)GetValue(ScaleXProperty);
1258 SetValue(ScaleXProperty, value);
1259 NotifyPropertyChanged();
1264 /// Gets or sets the scale Y factor applied to the view.
1268 /// Animatable - This property can be animated using <c>Animation</c> class.
1271 /// <since_tizen> 3 </since_tizen>
1276 return (float)GetValue(ScaleYProperty);
1280 SetValue(ScaleYProperty, value);
1281 NotifyPropertyChanged();
1286 /// Gets or sets the scale Z factor applied to the view.
1290 /// Animatable - This property can be animated using <c>Animation</c> class.
1293 /// <since_tizen> 3 </since_tizen>
1298 return (float)GetValue(ScaleZProperty);
1302 SetValue(ScaleZProperty, value);
1303 NotifyPropertyChanged();
1308 /// Gets the world scale of the view.
1310 /// <since_tizen> 3 </since_tizen>
1311 public Vector3 WorldScale
1315 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1316 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1322 /// Retrieves the visibility flag of the view.
1326 /// If the view is not visible, then the view and its children will not be rendered.
1327 /// 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.
1330 /// Animatable - This property can be animated using <c>Animation</c> class.
1333 /// <since_tizen> 3 </since_tizen>
1334 public bool Visibility
1339 GetProperty(View.Property.VISIBLE).Get(out temp);
1345 /// Gets the view's world color.
1347 /// <since_tizen> 3 </since_tizen>
1348 public Vector4 WorldColor
1352 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1353 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1359 /// Gets or sets the view's name.
1361 /// <since_tizen> 3 </since_tizen>
1366 return (string)GetValue(NameProperty);
1370 SetValue(NameProperty, value);
1371 NotifyPropertyChanged();
1376 /// Get the number of children held by the view.
1378 /// <since_tizen> 3 </since_tizen>
1379 public new uint ChildCount
1383 return GetChildCount();
1388 /// Gets the view's ID.
1391 /// <since_tizen> 3 </since_tizen>
1401 /// Gets or sets the status of whether the view should emit touch or hover signals.
1403 /// <since_tizen> 3 </since_tizen>
1404 public bool Sensitive
1408 return (bool)GetValue(SensitiveProperty);
1412 SetValue(SensitiveProperty, value);
1413 NotifyPropertyChanged();
1418 /// 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.
1420 /// <since_tizen> 3 </since_tizen>
1421 public bool LeaveRequired
1425 return (bool)GetValue(LeaveRequiredProperty);
1429 SetValue(LeaveRequiredProperty, value);
1430 NotifyPropertyChanged();
1435 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1437 /// <since_tizen> 3 </since_tizen>
1438 public bool InheritOrientation
1442 return (bool)GetValue(InheritOrientationProperty);
1446 SetValue(InheritOrientationProperty, value);
1447 NotifyPropertyChanged();
1452 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1454 /// <since_tizen> 3 </since_tizen>
1455 public bool InheritScale
1459 return (bool)GetValue(InheritScaleProperty);
1463 SetValue(InheritScaleProperty, value);
1464 NotifyPropertyChanged();
1469 /// Gets or sets the status of how the view and its children should be drawn.<br />
1470 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1471 /// 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 />
1472 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1473 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1474 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1476 /// <since_tizen> 3 </since_tizen>
1477 public DrawModeType DrawMode
1481 return (DrawModeType)GetValue(DrawModeProperty);
1485 SetValue(DrawModeProperty, value);
1486 NotifyPropertyChanged();
1491 /// Gets or sets the relative to parent size factor of the view.<br />
1492 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1493 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1496 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1498 /// <since_tizen> 3 </since_tizen>
1499 public Vector3 SizeModeFactor
1503 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1504 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1508 SetValue(SizeModeFactorProperty, value);
1509 NotifyPropertyChanged();
1514 /// Gets or sets the width resize policy to be used.
1516 /// <since_tizen> 3 </since_tizen>
1517 public ResizePolicyType WidthResizePolicy
1521 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1525 SetValue(WidthResizePolicyProperty, value);
1526 NotifyPropertyChanged();
1531 /// Gets or sets the height resize policy to be used.
1533 /// <since_tizen> 3 </since_tizen>
1534 public ResizePolicyType HeightResizePolicy
1538 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1542 SetValue(HeightResizePolicyProperty, value);
1543 NotifyPropertyChanged();
1548 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1549 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1551 /// <since_tizen> 3 </since_tizen>
1552 public SizeScalePolicyType SizeScalePolicy
1556 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1560 SetValue(SizeScalePolicyProperty, value);
1561 NotifyPropertyChanged();
1566 /// Gets or sets the status of whether the width size is dependent on the height size.
1568 /// <since_tizen> 3 </since_tizen>
1569 public bool WidthForHeight
1573 return (bool)GetValue(WidthForHeightProperty);
1577 SetValue(WidthForHeightProperty, value);
1578 NotifyPropertyChanged();
1583 /// Gets or sets the status of whether the height size is dependent on the width size.
1585 /// <since_tizen> 3 </since_tizen>
1586 public bool HeightForWidth
1590 return (bool)GetValue(HeightForWidthProperty);
1594 SetValue(HeightForWidthProperty, value);
1595 NotifyPropertyChanged();
1600 /// Gets or sets the padding for use in layout.
1603 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1605 /// <since_tizen> 5 </since_tizen>
1606 public Extents Padding
1610 // If View has a Layout then padding in stored in the base Layout class
1613 return Layout.Padding;
1617 Extents temp = (Extents)GetValue(PaddingProperty);
1618 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1620 // Two return points to prevent creating a zeroed Extent native object before assignment
1624 Extents padding = value;
1627 // Layout set so store Padding in LayoutItem instead of in View.
1628 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1629 // the position and sizes measure in the Layouting.
1630 Layout.Padding = value;
1631 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1632 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1633 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1635 padding = new Extents(0,0,0,0); // Reset value stored in View.
1637 _layout?.RequestLayout();
1639 SetValue(PaddingProperty, padding);
1640 NotifyPropertyChanged();
1641 _layout?.RequestLayout();
1646 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1649 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1651 /// <since_tizen> 3 </since_tizen>
1652 public Size2D MinimumSize
1656 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1657 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1661 if (_layout != null)
1663 // Note: it only works if minimum size is >= than natural size.
1664 // To force the size it should be done through the width&height spec or Size2D.
1665 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1666 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1667 _layout.RequestLayout();
1669 SetValue(MinimumSizeProperty, value);
1670 NotifyPropertyChanged();
1675 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1678 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1680 /// <since_tizen> 3 </since_tizen>
1681 public Size2D MaximumSize
1685 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1686 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1690 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1691 // MATCH_PARENT spec + parent container size can be used to limit
1692 if (_layout != null)
1694 _layout.RequestLayout();
1696 SetValue(MaximumSizeProperty, value);
1697 NotifyPropertyChanged();
1702 /// Gets or sets whether a child view inherits it's parent's position.<br />
1703 /// Default is to inherit.<br />
1704 /// 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 />
1706 /// <since_tizen> 3 </since_tizen>
1707 public bool InheritPosition
1711 return (bool)GetValue(InheritPositionProperty);
1715 SetValue(InheritPositionProperty, value);
1716 NotifyPropertyChanged();
1721 /// Gets or sets the clipping behavior (mode) of it's children.
1723 /// <since_tizen> 3 </since_tizen>
1724 public ClippingModeType ClippingMode
1728 return (ClippingModeType)GetValue(ClippingModeProperty);
1732 SetValue(ClippingModeProperty, value);
1733 NotifyPropertyChanged();
1738 /// Gets the number of renderers held by the view.
1740 /// <since_tizen> 3 </since_tizen>
1741 public uint RendererCount
1745 return GetRendererCount();
1750 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1753 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1755 /// <since_tizen> 3 </since_tizen>
1756 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1758 "View view = new View(); " +
1759 "view.PivotPoint = PivotPoint.Center; " +
1760 "view.PositionUsesPivotPoint = true;")]
1761 [EditorBrowsable(EditorBrowsableState.Never)]
1762 public Position AnchorPoint
1766 Position temp = new Position(0.0f, 0.0f, 0.0f);
1767 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1768 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1772 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1773 NotifyPropertyChanged();
1778 /// Sets the size of a view for the width, the height and the depth.<br />
1779 /// Geometry can be scaled to fit within this area.<br />
1780 /// This does not interfere with the view's scale factor.<br />
1781 /// The views default depth is the minimum of width and height.<br />
1785 /// Animatable - This property can be animated using <c>Animation</c> class.
1787 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1789 /// <since_tizen> 5 </since_tizen>
1794 Size tmp = (Size)GetValue(SizeProperty);
1795 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1799 SetValue(SizeProperty, value);
1800 NotifyPropertyChanged();
1805 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1807 /// <since_tizen> 3 </since_tizen>
1808 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1810 "Container parent = view.GetParent(); " +
1811 "View view = parent as View;")]
1812 [EditorBrowsable(EditorBrowsableState.Never)]
1813 public new View Parent
1818 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1819 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1820 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1822 if (basehandle is Layer layer)
1824 ret = new View(Layer.getCPtr(layer).Handle, false);
1825 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1829 ret = basehandle as View;
1832 Interop.BaseHandle.delete_BaseHandle(CPtr);
1833 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1835 if (NDalicPINVOKE.SWIGPendingException.Pending)
1836 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1842 /// Gets/Sets whether inherit parent's the layout Direction.
1844 /// <since_tizen> 4 </since_tizen>
1845 public bool InheritLayoutDirection
1849 return (bool)GetValue(InheritLayoutDirectionProperty);
1853 SetValue(InheritLayoutDirectionProperty, value);
1854 NotifyPropertyChanged();
1859 /// Gets/Sets the layout Direction.
1861 /// <since_tizen> 4 </since_tizen>
1862 public ViewLayoutDirectionType LayoutDirection
1866 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1870 SetValue(LayoutDirectionProperty, value);
1871 NotifyPropertyChanged();
1872 _layout?.RequestLayout();
1877 /// Gets or sets the Margin for use in layout.
1880 /// Margin property is supported by Layout algorithms and containers.
1881 /// Please Set Layout if you want to use Margin property.
1882 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1884 /// <since_tizen> 4 </since_tizen>
1885 public Extents Margin
1889 // If View has a Layout then margin is stored in Layout.
1892 return Layout.Margin;
1896 // If Layout not set then return margin stored in View.
1897 Extents temp = (Extents)GetValue(MarginProperty);
1898 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1900 // Two return points to prevent creating a zeroed Extent native object before assignment
1906 // Layout set so store Margin in LayoutItem instead of View.
1907 // If View stores the Margin too then the Legacy Size Negotiation will
1908 // overwrite the position and size values measured in the Layouting.
1909 Layout.Margin = value;
1910 SetValue(MarginProperty, new Extents(0,0,0,0));
1911 _layout?.RequestLayout();
1915 SetValue(MarginProperty, value);
1917 NotifyPropertyChanged();
1918 _layout?.RequestLayout();
1923 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1925 /// <since_tizen> 6 </since_tizen>
1926 public int WidthSpecification
1930 return _widthPolicy;
1934 _widthPolicy = value;
1935 if( _oldWidthPolicy != _widthPolicy )
1937 if (_widthPolicy >= 0)
1939 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1941 if(_heightPolicy>=0) // Policy an exact value
1943 Size2D.Width = _widthPolicy;
1947 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1948 // Size2D height will store the specification value (negative number) this will then be applied to the
1949 // HeightSpecification when the Size2D callback is invoked.
1950 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1953 _layout?.RequestLayout();
1954 _oldWidthPolicy = _widthPolicy;
1960 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1962 /// <since_tizen> 6 </since_tizen>
1963 public int HeightSpecification
1967 return _heightPolicy;
1971 _heightPolicy = value;
1972 if( _oldHeightPolicy != _heightPolicy )
1974 if (_heightPolicy >= 0)
1976 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1978 if(_widthPolicy>=0) // Policy an exact value
1980 Size2D.Height = _heightPolicy;
1984 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1985 // Size2D height will store the specification value (negative number) this will then be applied to the
1986 // HeightSpecification when the Size2D callback is invoked.
1987 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1991 _layout?.RequestLayout();
1992 _oldHeightPolicy = _heightPolicy;
1998 /// Gets the List of transitions for this View.
2000 /// <since_tizen> 6 </since_tizen>
2001 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2005 if (_layoutTransitions == null)
2007 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2009 return _layoutTransitions;
2014 /// Set a layout transitions for this View.
2017 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2019 /// <since_tizen> 6 </since_tizen>
2020 public LayoutTransition LayoutTransition
2024 if (_layoutTransitions == null)
2026 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2028 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2030 AttachTransitionsToChildren(value);
2035 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2038 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2040 /// <since_tizen> 4 </since_tizen>
2041 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2042 [EditorBrowsable(EditorBrowsableState.Never)]
2043 public Extents PaddingEX
2047 Extents temp = new Extents(0, 0, 0, 0);
2048 GetProperty(View.Property.PADDING).Get(temp);
2049 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2053 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2054 NotifyPropertyChanged();
2055 _layout?.RequestLayout();
2059 /// <since_tizen> 6 </since_tizen>
2060 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2061 [EditorBrowsable(EditorBrowsableState.Never)]
2062 public Style XamlStyle
2066 return (Style)GetValue(XamlStyleProperty);
2070 SetValue(XamlStyleProperty, value);
2075 /// The Color of View. This is an RGBA value.
2079 /// Animatable - This property can be animated using <c>Animation</c> class.
2081 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2083 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2084 [EditorBrowsable(EditorBrowsableState.Never)]
2089 Color temp = (Color)GetValue(ColorProperty);
2090 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2094 SetValue(ColorProperty, value);
2095 selectorData?.Color.UpdateIfNeeds(this, value);
2096 NotifyPropertyChanged();
2101 /// Set the layout on this View. Replaces any existing Layout.
2103 /// <since_tizen> 6 </since_tizen>
2104 public LayoutItem Layout
2112 // Do nothing if layout provided is already set on this View.
2113 if (value == _layout)
2118 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2119 layoutingDisabled = false;
2122 // If new layout being set already has a owner then that owner receives a replacement default layout.
2123 // First check if the layout to be set already has a owner.
2124 if (value?.Owner != null)
2126 // Previous owner of the layout gets a default layout as a replacement.
2127 value.Owner.Layout = new AbsoluteLayout();
2129 // Copy Margin and Padding to replacement LayoutGroup.
2130 value.Owner.Layout.Margin = value.Margin;
2131 value.Owner.Layout.Padding = value.Padding;
2134 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2135 // View if no replacement. Previously margin and padding values would have been moved from
2136 // the View to the layout.
2137 if (_layout != null ) // Existing layout
2141 // Existing layout being replaced so copy over margin and padding values.
2142 value.Margin = _layout.Margin;
2143 value.Padding = _layout.Padding;
2147 // Layout not being replaced so restore margin and padding to View.
2148 SetValue(MarginProperty, _layout.Margin);
2149 SetValue(PaddingProperty, _layout.Padding);
2150 NotifyPropertyChanged();
2155 // First Layout to be added to the View hence copy
2157 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2160 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2162 // If View already has a margin set then store it in Layout instead.
2163 value.Margin = Margin;
2164 SetValue(MarginProperty, new Extents(0,0,0,0));
2165 NotifyPropertyChanged();
2168 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2170 // If View already has a padding set then store it in Layout instead.
2171 value.Padding = Padding;
2172 SetValue(PaddingProperty, new Extents(0,0,0,0));
2173 NotifyPropertyChanged();
2178 // Remove existing layout from it's parent layout group.
2179 _layout?.Unparent();
2181 // Set layout to this view
2187 /// The weight of the View, used to share available space in a layout with siblings.
2189 /// <since_tizen> 6 </since_tizen>
2199 _layout?.RequestLayout();
2204 /// Whether to load the BackgroundImage synchronously.
2205 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2206 /// Note: For Normal Quad images only.
2208 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2209 [EditorBrowsable(EditorBrowsableState.Never)]
2210 public bool BackgroundImageSynchronosLoading
2214 return _backgroundImageSynchronosLoading;
2218 _backgroundImageSynchronosLoading = value;
2221 Background.Find(Visual.Property.Type)?.Get(out visualType);
2222 if (visualType == (int)Visual.Type.Image)
2224 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2227 if (bgUrl.Length != 0)
2229 PropertyMap bgMap = this.Background;
2230 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2236 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2237 [EditorBrowsable(EditorBrowsableState.Never)]
2238 public Vector2 UpdateSizeHint
2242 return (Vector2)GetValue(UpdateSizeHintProperty);
2246 SetValue(UpdateSizeHintProperty, value);
2247 NotifyPropertyChanged();
2251 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2252 [EditorBrowsable(EditorBrowsableState.Never)]
2253 public string[] TransitionNames
2257 return transitionNames;
2261 transitionNames = value;
2267 /// Enable/Disable ControlState propagation for children.
2268 /// It is false by default.
2269 /// If the View needs to share ControlState with descendants, please set it true.
2270 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2272 [EditorBrowsable(EditorBrowsableState.Never)]
2273 public bool EnableControlStatePropagation
2275 get => controlStatePropagation;
2278 controlStatePropagation = value;
2280 foreach (View child in Children)
2282 child.EnableControlStatePropagation = value;
2288 /// Get Style, it is abstract function and must be override.
2290 /// <since_tizen> 6 </since_tizen>
2291 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2292 // TODO: It should be deprecated. please use CreateViewStyle instead.
2293 [EditorBrowsable(EditorBrowsableState.Never)]
2294 protected virtual ViewStyle GetViewStyle()
2296 return CreateViewStyle();
2300 /// Create Style, it is abstract function and must be override.
2302 [EditorBrowsable(EditorBrowsableState.Never)]
2303 protected virtual ViewStyle CreateViewStyle()
2305 return new ViewStyle();
2309 /// Called after the View's ControlStates changed.
2311 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2312 [EditorBrowsable(EditorBrowsableState.Never)]
2313 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2317 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2318 [EditorBrowsable(EditorBrowsableState.Never)]
2319 public virtual void ApplyStyle(ViewStyle viewStyle)
2321 if (null == viewStyle || this.viewStyle == viewStyle) return;
2323 this.viewStyle = viewStyle;
2325 Dictionary<string, BindableProperty> bindablePropertyOfView;
2326 Type viewType = GetType();
2328 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2329 Type styleType = viewStyle.GetType();
2331 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2332 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2334 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2336 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2338 BindableProperty viewProperty;
2339 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2341 if (null != viewProperty)
2343 object value = viewStyle.GetValue(keyValuePair.Value);
2347 SetValue(viewProperty, value);