2 * Copyright(c) 2020 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
32 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
33 internal BackgroundExtraData backgroundExtraData;
35 private bool layoutSet = false;
36 private LayoutItem layout; // Exclusive layout assigned to this View.
38 // List of transitions paired with the condition that uses the transition.
39 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
40 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
41 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
42 private int oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later
43 private int oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later
44 private float weight = 0.0f; // Weighting of child View in a Layout
45 private MeasureSpecification measureSpecificationWidth; // Layout width and internal Mode
46 private MeasureSpecification measureSpecificationHeight; // Layout height and internal Mode
47 private bool backgroundImageSynchronosLoading = false;
48 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
49 private string[] transitionNames;
50 private bool controlStatePropagation = false;
51 private ViewStyle viewStyle;
52 private bool themeChangeSensitive = false;
53 private bool excludeLayouting = false;
55 private ControlState controlStates = ControlState.Normal;
60 /// Creates a new instance of a view.
62 /// <since_tizen> 3 </since_tizen>
63 public View() : this(Interop.View.New(), true)
65 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
69 [EditorBrowsable(EditorBrowsableState.Never)]
70 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
75 /// Create a new instance of a View with setting the status of shown or hidden.
77 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
78 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
79 [EditorBrowsable(EditorBrowsableState.Never)]
80 public View(bool shown) : this(Interop.View.New(), true)
82 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
88 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
97 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
99 InitializeStyle(viewStyle);
102 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.Upcast(cPtr), cMemoryOwn)
106 PositionUsesPivotPoint = false;
109 //ToDo: this has memory leak and this is not used currently. will be fixed soon by using Event subscribing pattern.
110 //_onWindowSendEventCallback = SendViewAddedEventToWindow;
111 //this.OnWindowSignal().Connect(_onWindowSendEventCallback);
119 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
121 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130 /// The event that is triggered when the View's ControlState is changed.
132 [EditorBrowsable(EditorBrowsableState.Never)]
133 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
135 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
139 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
141 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
142 [EditorBrowsable(EditorBrowsableState.Never)]
143 public bool LayoutSet
152 /// Flag to allow Layouting to be disabled for Views.
153 /// Once a View has a Layout set then any children added to Views from then on will receive
154 /// automatic Layouts.
156 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
157 [EditorBrowsable(EditorBrowsableState.Never)]
158 public static bool LayoutingDisabled { get; set; } = true;
160 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
161 [EditorBrowsable(EditorBrowsableState.Never)]
162 public ViewStyle ViewStyle
166 if (null == viewStyle)
168 ApplyStyle(GetViewStyle());
176 /// Get/Set the control state.
178 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
179 [EditorBrowsable(EditorBrowsableState.Never)]
180 public ControlState ControlState
184 return controlStates;
188 if (controlStates == value)
193 var prevState = controlStates;
195 controlStates = value;
197 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
199 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
201 if (controlStatePropagation)
203 foreach (View child in Children)
205 child.ControlState = value;
209 OnControlStateChanged(changeInfo);
211 ControlStateChangedEvent?.Invoke(this, changeInfo);
215 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
216 [EditorBrowsable(EditorBrowsableState.Never)]
217 public bool ExcludeLayouting
221 return excludeLayouting;
225 excludeLayouting = value;
226 if (Layout != null && Layout.SetPositionByLayout == value)
228 Layout.SetPositionByLayout = !value;
229 Layout.RequestLayout();
234 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
235 [EditorBrowsable(EditorBrowsableState.Never)]
236 public bool IsResourcesCreated
240 return Application.Current.IsResourcesCreated;
244 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
245 [EditorBrowsable(EditorBrowsableState.Never)]
246 public ResourceDictionary XamlResources
250 return Application.Current.XamlResources;
254 Application.Current.XamlResources = value;
259 /// The StyleName, type string.
260 /// The value indicates DALi style name defined in json theme file.
262 /// <since_tizen> 3 </since_tizen>
263 public string StyleName
267 return (string)GetValue(StyleNameProperty);
271 SetValue(StyleNameProperty, value);
272 NotifyPropertyChanged();
277 /// The KeyInputFocus, type bool.
279 [EditorBrowsable(EditorBrowsableState.Never)]
280 public bool KeyInputFocus
284 return (bool)GetValue(KeyInputFocusProperty);
288 SetValue(KeyInputFocusProperty, value);
289 NotifyPropertyChanged();
294 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
297 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
299 /// <since_tizen> 3 </since_tizen>
300 public Color BackgroundColor
304 Color temp = (Color)GetValue(BackgroundColorProperty);
305 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
309 SetValue(BackgroundColorProperty, value);
310 if (selectorData != null)
312 selectorData.BackgroundImage.Reset(this);
313 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
315 NotifyPropertyChanged();
320 /// The mutually exclusive with "backgroundColor" and "background" type Map.
322 /// <since_tizen> 3 </since_tizen>
323 public string BackgroundImage
327 return (string)GetValue(BackgroundImageProperty);
331 SetValue(BackgroundImageProperty, value);
332 if (selectorData != null)
334 selectorData.BackgroundColor.Reset(this);
335 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
337 NotifyPropertyChanged();
342 /// Get or set the border of background image.
344 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
345 [EditorBrowsable(EditorBrowsableState.Never)]
346 public Rectangle BackgroundImageBorder
350 return (Rectangle)GetValue(BackgroundImageBorderProperty);
354 SetValue(BackgroundImageBorderProperty, value);
355 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
356 NotifyPropertyChanged();
361 /// The background of view.
363 /// <since_tizen> 3 </since_tizen>
364 public Tizen.NUI.PropertyMap Background
368 return (PropertyMap)GetValue(BackgroundProperty);
372 SetValue(BackgroundProperty, value);
373 NotifyPropertyChanged();
378 /// Describes a shadow as an image for a View.
379 /// It is null by default.
382 /// Getter returns copied instance of current shadow.
385 /// The mutually exclusive with "BoxShadow".
387 [EditorBrowsable(EditorBrowsableState.Never)]
388 public ImageShadow ImageShadow
392 return (ImageShadow)GetValue(ImageShadowProperty);
396 SetValue(ImageShadowProperty, value);
397 if (selectorData != null)
399 selectorData.BoxShadow.Reset(this);
400 selectorData.ImageShadow.UpdateIfNeeds(this, value);
402 NotifyPropertyChanged();
407 /// Describes a box shaped shadow drawing for a View.
408 /// It is null by default.
411 /// Gettter returns copied instance of current shadow.
414 /// The mutually exclusive with "ImageShadow".
416 [EditorBrowsable(EditorBrowsableState.Never)]
417 public Shadow BoxShadow
421 return (Shadow)GetValue(BoxShadowProperty);
425 SetValue(BoxShadowProperty, value);
426 if (selectorData != null)
428 selectorData.ImageShadow.Reset(this);
429 selectorData.BoxShadow.UpdateIfNeeds(this, value);
431 NotifyPropertyChanged();
436 /// The radius for the rounded corners of the View.
437 /// This will rounds background and shadow edges.
438 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
440 [EditorBrowsable(EditorBrowsableState.Never)]
441 public float CornerRadius
445 return (float)GetValue(CornerRadiusProperty);
449 SetValue(CornerRadiusProperty, value);
450 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
451 NotifyPropertyChanged();
456 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
457 /// It is absolute by default.
458 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
460 [EditorBrowsable(EditorBrowsableState.Never)]
461 public VisualTransformPolicyType CornerRadiusPolicy
463 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
464 set => SetValue(CornerRadiusPolicyProperty, value);
468 /// The current state of the view.
470 /// <since_tizen> 3 </since_tizen>
475 return (States)GetValue(StateProperty);
479 SetValue(StateProperty, value);
480 NotifyPropertyChanged();
485 /// The current sub state of the view.
487 /// <since_tizen> 3 </since_tizen>
488 public States SubState
492 return (States)GetValue(SubStateProperty);
496 SetValue(SubStateProperty, value);
497 NotifyPropertyChanged();
502 /// Displays a tooltip
504 /// <since_tizen> 3 </since_tizen>
505 public Tizen.NUI.PropertyMap Tooltip
509 return (PropertyMap)GetValue(TooltipProperty);
513 SetValue(TooltipProperty, value);
514 NotifyPropertyChanged();
519 /// Displays a tooltip as a text.
521 /// <since_tizen> 3 </since_tizen>
522 public string TooltipText
526 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
527 NotifyPropertyChanged();
532 /// The Child property of FlexContainer.<br />
533 /// The proportion of the free space in the container, the flex item will receive.<br />
534 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
536 /// <since_tizen> 3 </since_tizen>
537 [Obsolete("Deprecated in API8, will be removed in API10.")]
542 return (float)GetValue(FlexProperty);
546 SetValue(FlexProperty, value);
547 NotifyPropertyChanged();
552 /// The Child property of FlexContainer.<br />
553 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
555 /// <since_tizen> 3 </since_tizen>
556 [Obsolete("Deprecated in API8, will be removed in API10.")]
561 return (int)GetValue(AlignSelfProperty);
565 SetValue(AlignSelfProperty, value);
566 NotifyPropertyChanged();
571 /// The Child property of FlexContainer.<br />
572 /// The space around the flex item.<br />
575 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
577 /// <since_tizen> 3 </since_tizen>
578 [Obsolete("Deprecated in API8, will be removed in API10.")]
579 public Vector4 FlexMargin
583 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
584 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
588 SetValue(FlexMarginProperty, value);
589 NotifyPropertyChanged();
594 /// The top-left cell this child occupies, if not set, the first available cell is used.
597 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
599 /// <since_tizen> 3 </since_tizen>
600 public Vector2 CellIndex
604 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
605 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
609 SetValue(CellIndexProperty, value);
610 NotifyPropertyChanged();
615 /// The number of rows this child occupies, if not set, the default value is 1.
617 /// <since_tizen> 3 </since_tizen>
622 return (float)GetValue(RowSpanProperty);
626 SetValue(RowSpanProperty, value);
627 NotifyPropertyChanged();
632 /// The number of columns this child occupies, if not set, the default value is 1.
634 /// <since_tizen> 3 </since_tizen>
635 public float ColumnSpan
639 return (float)GetValue(ColumnSpanProperty);
643 SetValue(ColumnSpanProperty, value);
644 NotifyPropertyChanged();
649 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
651 /// <since_tizen> 3 </since_tizen>
652 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
656 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
660 SetValue(CellHorizontalAlignmentProperty, value);
661 NotifyPropertyChanged();
666 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
668 /// <since_tizen> 3 </since_tizen>
669 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
673 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
677 SetValue(CellVerticalAlignmentProperty, value);
678 NotifyPropertyChanged();
683 /// The left focusable view.<br />
684 /// This will return null if not set.<br />
685 /// This will also return null if the specified left focusable view is not on a window.<br />
687 /// <since_tizen> 3 </since_tizen>
688 public View LeftFocusableView
690 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
693 return (View)GetValue(LeftFocusableViewProperty);
697 SetValue(LeftFocusableViewProperty, value);
698 NotifyPropertyChanged();
703 /// The right focusable view.<br />
704 /// This will return null if not set.<br />
705 /// This will also return null if the specified right focusable view is not on a window.<br />
707 /// <since_tizen> 3 </since_tizen>
708 public View RightFocusableView
710 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
713 return (View)GetValue(RightFocusableViewProperty);
717 SetValue(RightFocusableViewProperty, value);
718 NotifyPropertyChanged();
723 /// The up focusable view.<br />
724 /// This will return null if not set.<br />
725 /// This will also return null if the specified up focusable view is not on a window.<br />
727 /// <since_tizen> 3 </since_tizen>
728 public View UpFocusableView
730 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
733 return (View)GetValue(UpFocusableViewProperty);
737 SetValue(UpFocusableViewProperty, value);
738 NotifyPropertyChanged();
743 /// The down focusable view.<br />
744 /// This will return null if not set.<br />
745 /// This will also return null if the specified down focusable view is not on a window.<br />
747 /// <since_tizen> 3 </since_tizen>
748 public View DownFocusableView
750 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
753 return (View)GetValue(DownFocusableViewProperty);
757 SetValue(DownFocusableViewProperty, value);
758 NotifyPropertyChanged();
763 /// Whether the view should be focusable by keyboard navigation.
765 /// <since_tizen> 3 </since_tizen>
766 public bool Focusable
770 SetValue(FocusableProperty, value);
771 NotifyPropertyChanged();
775 return (bool)GetValue(FocusableProperty);
780 /// Retrieves the position of the view.<br />
781 /// The coordinates are relative to the view's parent.<br />
783 /// <since_tizen> 3 </since_tizen>
784 public Position CurrentPosition
788 return GetCurrentPosition();
793 /// Sets the size of a view for the width and the height.<br />
794 /// Geometry can be scaled to fit within this area.<br />
795 /// This does not interfere with the view's scale factor.<br />
796 /// The views default depth is the minimum of width and height.<br />
799 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
800 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
802 /// <since_tizen> 3 </since_tizen>
807 Size2D temp = (Size2D)GetValue(Size2DProperty);
808 int width = temp.Width;
809 int height = temp.Height;
811 if (this.Layout == null)
813 if (width < 0) { width = 0; }
814 if (height < 0) { height = 0; }
817 return new Size2D(OnSize2DChanged, width, height);
821 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
822 SetValue(Size2DProperty, value);
823 // Set Specification so when layouts measure this View it matches the value set here.
824 // All Views are currently Layouts.
825 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
826 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
827 widthPolicy = value.Width;
828 heightPolicy = value.Height;
830 layout?.RequestLayout();
831 NotifyPropertyChanged();
836 /// Retrieves the size of the view.<br />
837 /// The coordinates are relative to the view's parent.<br />
839 /// <since_tizen> 3 </since_tizen>
840 public Size2D CurrentSize
844 return GetCurrentSize();
849 /// Retrieves and sets the view's opacity.<br />
851 /// <since_tizen> 3 </since_tizen>
856 return (float)GetValue(OpacityProperty);
860 SetValue(OpacityProperty, value);
861 selectorData?.Opacity.UpdateIfNeeds(this, value);
862 NotifyPropertyChanged();
867 /// Sets the position of the view for X and Y.<br />
868 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
869 /// If the position inheritance is disabled, sets the world position.<br />
872 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
873 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
875 /// <since_tizen> 3 </since_tizen>
876 public Position2D Position2D
880 Position2D temp = (Position2D)GetValue(Position2DProperty);
881 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
885 SetValue(Position2DProperty, value);
886 NotifyPropertyChanged();
891 /// Retrieves the screen postion of the view.<br />
893 /// <since_tizen> 3 </since_tizen>
894 public Vector2 ScreenPosition
898 Vector2 temp = new Vector2(0.0f, 0.0f);
899 GetProperty(View.Property.ScreenPosition).Get(temp);
905 /// Determines whether the pivot point should be used to determine the position of the view.
906 /// This is false by default.
908 /// <remarks>If false, then the top-left of the view is used for the position.
909 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
911 /// <since_tizen> 3 </since_tizen>
912 public bool PositionUsesPivotPoint
916 return (bool)GetValue(PositionUsesPivotPointProperty);
920 SetValue(PositionUsesPivotPointProperty, value);
921 NotifyPropertyChanged();
926 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
928 /// <since_tizen> 3 </since_tizen>
929 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
931 "View view = new View(); " +
932 "view.PivotPoint = PivotPoint.Center; " +
933 "view.PositionUsesPivotPoint = true;" +
934 " Deprecated in API5: Will be removed in API8")]
935 [EditorBrowsable(EditorBrowsableState.Never)]
936 public bool PositionUsesAnchorPoint
941 GetProperty(View.Property.PositionUsesAnchorPoint).Get(out temp);
946 SetProperty(View.Property.PositionUsesAnchorPoint, new Tizen.NUI.PropertyValue(value));
947 NotifyPropertyChanged();
952 /// Queries whether the view is connected to the stage.<br />
953 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
955 /// <since_tizen> 3 </since_tizen>
956 public bool IsOnWindow
965 /// Gets the depth in the hierarchy for the view.
967 /// <since_tizen> 3 </since_tizen>
968 public int HierarchyDepth
972 return GetHierarchyDepth();
977 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
980 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
981 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
982 /// The values set by this property will likely change.
984 /// <since_tizen> 3 </since_tizen>
985 public int SiblingOrder
989 return (int)GetValue(SiblingOrderProperty);
993 SetValue(SiblingOrderProperty, value);
995 LayoutGroup layout = Layout as LayoutGroup;
996 layout?.ChangeLayoutSiblingOrder(value);
998 NotifyPropertyChanged();
1003 /// Returns the natural size of the view.
1006 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1008 /// <since_tizen> 5 </since_tizen>
1009 public Vector3 NaturalSize
1013 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1014 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1020 /// Returns the natural size (Size2D) of the view.
1023 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1025 /// <since_tizen> 4 </since_tizen>
1026 public Size2D NaturalSize2D
1030 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1031 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1033 return new Size2D((int)temp.Width, (int)temp.Height);
1038 /// Gets or sets the origin of a view within its parent's area.<br />
1039 /// 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 />
1040 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1041 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1043 /// <pre>The view has been initialized.</pre>
1044 /// <since_tizen> 3 </since_tizen>
1045 public Position ParentOrigin
1049 Position tmp = (Position)GetValue(ParentOriginProperty);
1050 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1054 SetValue(ParentOriginProperty, value);
1055 NotifyPropertyChanged();
1060 /// Gets or sets the anchor-point of a view.<br />
1061 /// 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 />
1062 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1063 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1064 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1065 /// <pre>The view has been initialized.</pre>
1068 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1070 /// <since_tizen> 3 </since_tizen>
1071 public Position PivotPoint
1075 Position tmp = (Position)GetValue(PivotPointProperty);
1076 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1080 SetValue(PivotPointProperty, value);
1081 NotifyPropertyChanged();
1086 /// Gets or sets the size width of the view.
1090 /// Animatable - This property can be animated using <c>Animation</c> class.
1093 /// <since_tizen> 3 </since_tizen>
1094 public float SizeWidth
1098 return (float)GetValue(SizeWidthProperty);
1102 SetValue(SizeWidthProperty, value);
1103 NotifyPropertyChanged();
1108 /// Gets or sets the size height of the view.
1112 /// Animatable - This property can be animated using <c>Animation</c> class.
1115 /// <since_tizen> 3 </since_tizen>
1116 public float SizeHeight
1120 return (float)GetValue(SizeHeightProperty);
1124 SetValue(SizeHeightProperty, value);
1125 NotifyPropertyChanged();
1130 /// Gets or sets the position of the view.<br />
1131 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1132 /// If the position inheritance is disabled, sets the world position.<br />
1136 /// Animatable - This property can be animated using <c>Animation</c> class.
1138 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1140 /// <since_tizen> 3 </since_tizen>
1141 public Position Position
1145 Position tmp = (Position)GetValue(PositionProperty);
1146 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1150 SetValue(PositionProperty, value);
1151 NotifyPropertyChanged();
1156 /// Gets or sets the position X of the view.
1160 /// Animatable - This property can be animated using <c>Animation</c> class.
1163 /// <since_tizen> 3 </since_tizen>
1164 public float PositionX
1168 return (float)GetValue(PositionXProperty);
1172 SetValue(PositionXProperty, value);
1173 NotifyPropertyChanged();
1178 /// Gets or sets the position Y of the view.
1182 /// Animatable - This property can be animated using <c>Animation</c> class.
1185 /// <since_tizen> 3 </since_tizen>
1186 public float PositionY
1190 return (float)GetValue(PositionYProperty);
1194 SetValue(PositionYProperty, value);
1195 NotifyPropertyChanged();
1200 /// Gets or sets the position Z of the view.
1204 /// Animatable - This property can be animated using <c>Animation</c> class.
1207 /// <since_tizen> 3 </since_tizen>
1208 public float PositionZ
1212 return (float)GetValue(PositionZProperty);
1216 SetValue(PositionZProperty, value);
1217 NotifyPropertyChanged();
1222 /// Gets or sets the world position of the view.
1224 /// <since_tizen> 3 </since_tizen>
1225 public Vector3 WorldPosition
1229 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1230 GetProperty(View.Property.WorldPosition).Get(temp);
1236 /// Gets or sets the orientation of the view.<br />
1237 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1241 /// This is an asynchronous method.
1244 /// Animatable - This property can be animated using <c>Animation</c> class.
1247 /// <since_tizen> 3 </since_tizen>
1248 public Rotation Orientation
1252 return (Rotation)GetValue(OrientationProperty);
1256 SetValue(OrientationProperty, value);
1257 NotifyPropertyChanged();
1262 /// Gets or sets the world orientation of the view.<br />
1264 /// <since_tizen> 3 </since_tizen>
1265 public Rotation WorldOrientation
1269 Rotation temp = new Rotation();
1270 GetProperty(View.Property.WorldOrientation).Get(temp);
1276 /// Gets or sets the scale factor applied to the view.<br />
1280 /// Animatable - This property can be animated using <c>Animation</c> class.
1282 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1284 /// <since_tizen> 3 </since_tizen>
1285 public Vector3 Scale
1289 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1290 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1294 SetValue(ScaleProperty, value);
1295 NotifyPropertyChanged();
1300 /// Gets or sets the scale X factor applied to the view.
1304 /// Animatable - This property can be animated using <c>Animation</c> class.
1307 /// <since_tizen> 3 </since_tizen>
1312 return (float)GetValue(ScaleXProperty);
1316 SetValue(ScaleXProperty, value);
1317 NotifyPropertyChanged();
1322 /// Gets or sets the scale Y factor applied to the view.
1326 /// Animatable - This property can be animated using <c>Animation</c> class.
1329 /// <since_tizen> 3 </since_tizen>
1334 return (float)GetValue(ScaleYProperty);
1338 SetValue(ScaleYProperty, value);
1339 NotifyPropertyChanged();
1344 /// Gets or sets the scale Z factor applied to the view.
1348 /// Animatable - This property can be animated using <c>Animation</c> class.
1351 /// <since_tizen> 3 </since_tizen>
1356 return (float)GetValue(ScaleZProperty);
1360 SetValue(ScaleZProperty, value);
1361 NotifyPropertyChanged();
1366 /// Gets the world scale of the view.
1368 /// <since_tizen> 3 </since_tizen>
1369 public Vector3 WorldScale
1373 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1374 GetProperty(View.Property.WorldScale).Get(temp);
1380 /// Retrieves the visibility flag of the view.
1384 /// If the view is not visible, then the view and its children will not be rendered.
1385 /// 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.
1388 /// Animatable - This property can be animated using <c>Animation</c> class.
1391 /// <since_tizen> 3 </since_tizen>
1392 public bool Visibility
1397 GetProperty(View.Property.VISIBLE).Get(out temp);
1403 /// Gets the view's world color.
1405 /// <since_tizen> 3 </since_tizen>
1406 public Vector4 WorldColor
1410 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1411 GetProperty(View.Property.WorldColor).Get(temp);
1417 /// Gets or sets the view's name.
1419 /// <since_tizen> 3 </since_tizen>
1424 return (string)GetValue(NameProperty);
1428 SetValue(NameProperty, value);
1429 NotifyPropertyChanged();
1434 /// Get the number of children held by the view.
1436 /// <since_tizen> 3 </since_tizen>
1437 public new uint ChildCount
1441 return GetChildCount();
1446 /// Gets the view's ID.
1449 /// <since_tizen> 3 </since_tizen>
1459 /// Gets or sets the status of whether the view should emit touch or hover signals.
1461 /// <since_tizen> 3 </since_tizen>
1462 public bool Sensitive
1466 return (bool)GetValue(SensitiveProperty);
1470 SetValue(SensitiveProperty, value);
1471 NotifyPropertyChanged();
1476 /// 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.
1478 /// <since_tizen> 3 </since_tizen>
1479 public bool LeaveRequired
1483 return (bool)GetValue(LeaveRequiredProperty);
1487 SetValue(LeaveRequiredProperty, value);
1488 NotifyPropertyChanged();
1493 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1495 /// <since_tizen> 3 </since_tizen>
1496 public bool InheritOrientation
1500 return (bool)GetValue(InheritOrientationProperty);
1504 SetValue(InheritOrientationProperty, value);
1505 NotifyPropertyChanged();
1510 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1512 /// <since_tizen> 3 </since_tizen>
1513 public bool InheritScale
1517 return (bool)GetValue(InheritScaleProperty);
1521 SetValue(InheritScaleProperty, value);
1522 NotifyPropertyChanged();
1527 /// Gets or sets the status of how the view and its children should be drawn.<br />
1528 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1529 /// 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 />
1530 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1531 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1532 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1534 /// <since_tizen> 3 </since_tizen>
1535 public DrawModeType DrawMode
1539 return (DrawModeType)GetValue(DrawModeProperty);
1543 SetValue(DrawModeProperty, value);
1544 NotifyPropertyChanged();
1549 /// Gets or sets the relative to parent size factor of the view.<br />
1550 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1551 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1554 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1556 /// <since_tizen> 3 </since_tizen>
1557 public Vector3 SizeModeFactor
1561 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1562 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1566 SetValue(SizeModeFactorProperty, value);
1567 NotifyPropertyChanged();
1572 /// Gets or sets the width resize policy to be used.
1574 /// <since_tizen> 3 </since_tizen>
1575 public ResizePolicyType WidthResizePolicy
1579 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1583 SetValue(WidthResizePolicyProperty, value);
1584 NotifyPropertyChanged();
1589 /// Gets or sets the height resize policy to be used.
1591 /// <since_tizen> 3 </since_tizen>
1592 public ResizePolicyType HeightResizePolicy
1596 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1600 SetValue(HeightResizePolicyProperty, value);
1601 NotifyPropertyChanged();
1606 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1607 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1609 /// <since_tizen> 3 </since_tizen>
1610 public SizeScalePolicyType SizeScalePolicy
1614 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1618 SetValue(SizeScalePolicyProperty, value);
1619 NotifyPropertyChanged();
1624 /// Gets or sets the status of whether the width size is dependent on the height size.
1626 /// <since_tizen> 3 </since_tizen>
1627 public bool WidthForHeight
1631 return (bool)GetValue(WidthForHeightProperty);
1635 SetValue(WidthForHeightProperty, value);
1636 NotifyPropertyChanged();
1641 /// Gets or sets the status of whether the height size is dependent on the width size.
1643 /// <since_tizen> 3 </since_tizen>
1644 public bool HeightForWidth
1648 return (bool)GetValue(HeightForWidthProperty);
1652 SetValue(HeightForWidthProperty, value);
1653 NotifyPropertyChanged();
1658 /// Gets or sets the padding for use in layout.
1661 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1663 /// <since_tizen> 5 </since_tizen>
1664 public Extents Padding
1668 // If View has a Layout then padding in stored in the base Layout class
1671 return Layout.Padding;
1675 Extents temp = (Extents)GetValue(PaddingProperty);
1676 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1678 // Two return points to prevent creating a zeroed Extent native object before assignment
1682 Extents padding = value;
1685 // Layout set so store Padding in LayoutItem instead of in View.
1686 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1687 // the position and sizes measure in the Layouting.
1688 Layout.Padding = value;
1689 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1690 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1691 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1693 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1697 SetValue(PaddingProperty, padding);
1698 NotifyPropertyChanged();
1703 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1705 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1707 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1709 /// <since_tizen> 3 </since_tizen>
1710 public Size2D MinimumSize
1714 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1715 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1721 throw new ArgumentNullException(nameof(value));
1725 // Note: it only works if minimum size is >= than natural size.
1726 // To force the size it should be done through the width&height spec or Size2D.
1727 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1728 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1729 layout.RequestLayout();
1731 SetValue(MinimumSizeProperty, value);
1732 NotifyPropertyChanged();
1737 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1740 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1742 /// <since_tizen> 3 </since_tizen>
1743 public Size2D MaximumSize
1747 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1748 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1752 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1753 // MATCH_PARENT spec + parent container size can be used to limit
1756 layout.RequestLayout();
1758 SetValue(MaximumSizeProperty, value);
1759 NotifyPropertyChanged();
1764 /// Gets or sets whether a child view inherits it's parent's position.<br />
1765 /// Default is to inherit.<br />
1766 /// 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 />
1768 /// <since_tizen> 3 </since_tizen>
1769 public bool InheritPosition
1773 return (bool)GetValue(InheritPositionProperty);
1777 SetValue(InheritPositionProperty, value);
1778 NotifyPropertyChanged();
1783 /// Gets or sets the clipping behavior (mode) of it's children.
1785 /// <since_tizen> 3 </since_tizen>
1786 public ClippingModeType ClippingMode
1790 return (ClippingModeType)GetValue(ClippingModeProperty);
1794 SetValue(ClippingModeProperty, value);
1795 NotifyPropertyChanged();
1800 /// Gets the number of renderers held by the view.
1802 /// <since_tizen> 3 </since_tizen>
1803 public uint RendererCount
1807 return GetRendererCount();
1812 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1815 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1817 /// <since_tizen> 3 </since_tizen>
1818 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1820 "View view = new View(); " +
1821 "view.PivotPoint = PivotPoint.Center; " +
1822 "view.PositionUsesPivotPoint = true;")]
1823 [EditorBrowsable(EditorBrowsableState.Never)]
1824 public Position AnchorPoint
1828 Position temp = new Position(0.0f, 0.0f, 0.0f);
1829 GetProperty(View.Property.AnchorPoint).Get(temp);
1830 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1834 SetProperty(View.Property.AnchorPoint, new Tizen.NUI.PropertyValue(value));
1835 NotifyPropertyChanged();
1840 /// Sets the size of a view for the width, the height and the depth.<br />
1841 /// Geometry can be scaled to fit within this area.<br />
1842 /// This does not interfere with the view's scale factor.<br />
1843 /// The views default depth is the minimum of width and height.<br />
1847 /// Animatable - This property can be animated using <c>Animation</c> class.
1849 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1851 /// <since_tizen> 5 </since_tizen>
1856 Size tmp = (Size)GetValue(SizeProperty);
1857 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1861 SetValue(SizeProperty, value);
1862 NotifyPropertyChanged();
1867 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1869 /// <since_tizen> 3 </since_tizen>
1870 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1872 "Container parent = view.GetParent(); " +
1873 "View view = parent as View;")]
1874 [EditorBrowsable(EditorBrowsableState.Never)]
1875 public new View Parent
1880 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
1881 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1882 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1884 if (basehandle is Layer layer)
1886 ret = new View(Layer.getCPtr(layer).Handle, false);
1887 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1891 ret = basehandle as View;
1894 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1895 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1897 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1903 /// Gets/Sets whether inherit parent's the layout Direction.
1905 /// <since_tizen> 4 </since_tizen>
1906 public bool InheritLayoutDirection
1910 return (bool)GetValue(InheritLayoutDirectionProperty);
1914 SetValue(InheritLayoutDirectionProperty, value);
1915 NotifyPropertyChanged();
1920 /// Gets/Sets the layout Direction.
1922 /// <since_tizen> 4 </since_tizen>
1923 public ViewLayoutDirectionType LayoutDirection
1927 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1931 SetValue(LayoutDirectionProperty, value);
1932 NotifyPropertyChanged();
1933 layout?.RequestLayout();
1938 /// Gets or sets the Margin for use in layout.
1941 /// Margin property is supported by Layout algorithms and containers.
1942 /// Please Set Layout if you want to use Margin property.
1943 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1945 /// <since_tizen> 4 </since_tizen>
1946 public Extents Margin
1950 // If View has a Layout then margin is stored in Layout.
1953 return Layout.Margin;
1957 // If Layout not set then return margin stored in View.
1958 Extents temp = (Extents)GetValue(MarginProperty);
1959 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1961 // Two return points to prevent creating a zeroed Extent native object before assignment
1967 // Layout set so store Margin in LayoutItem instead of View.
1968 // If View stores the Margin too then the Legacy Size Negotiation will
1969 // overwrite the position and size values measured in the Layouting.
1970 Layout.Margin = value;
1971 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
1972 layout?.RequestLayout();
1976 SetValue(MarginProperty, value);
1978 NotifyPropertyChanged();
1979 layout?.RequestLayout();
1984 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1986 /// <since_tizen> 6 </since_tizen>
1987 public int WidthSpecification
1995 widthPolicy = value;
1996 if (oldWidthPolicy != widthPolicy)
1998 if (widthPolicy >= 0)
2000 measureSpecificationWidth = new MeasureSpecification(new LayoutLength(value), MeasureSpecification.ModeType.Exactly);
2002 if (heightPolicy >= 0) // Policy an exact value
2004 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2005 Size2D = new Size2D(widthPolicy, heightPolicy);
2008 layout?.RequestLayout();
2009 oldWidthPolicy = widthPolicy;
2015 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2017 /// <since_tizen> 6 </since_tizen>
2018 public int HeightSpecification
2022 return heightPolicy;
2026 heightPolicy = value;
2027 if (oldHeightPolicy != heightPolicy)
2029 if (heightPolicy >= 0)
2031 measureSpecificationHeight = new MeasureSpecification(new LayoutLength(value), MeasureSpecification.ModeType.Exactly);
2033 if (widthPolicy >= 0) // Policy an exact value
2035 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2036 Size2D = new Size2D(widthPolicy, heightPolicy);
2040 layout?.RequestLayout();
2041 oldHeightPolicy = heightPolicy;
2047 /// Gets the List of transitions for this View.
2049 /// <since_tizen> 6 </since_tizen>
2050 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2054 if (layoutTransitions == null)
2056 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2058 return layoutTransitions;
2063 /// Set a layout transitions for this View.
2065 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2067 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2069 /// <since_tizen> 6 </since_tizen>
2070 public LayoutTransition LayoutTransition
2076 throw new global::System.ArgumentNullException(nameof(value));
2078 if (layoutTransitions == null)
2080 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2083 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2085 AttachTransitionsToChildren(value);
2090 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2093 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2095 /// <since_tizen> 4 </since_tizen>
2096 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2097 [EditorBrowsable(EditorBrowsableState.Never)]
2098 public Extents PaddingEX
2102 Extents temp = new Extents(0, 0, 0, 0);
2103 GetProperty(View.Property.PADDING).Get(temp);
2104 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2108 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2109 NotifyPropertyChanged();
2110 layout?.RequestLayout();
2115 /// The Color of View. This is an RGBA value.
2119 /// Animatable - This property can be animated using <c>Animation</c> class.
2121 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2123 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2124 [EditorBrowsable(EditorBrowsableState.Never)]
2129 Color temp = (Color)GetValue(ColorProperty);
2130 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2134 SetValue(ColorProperty, value);
2135 selectorData?.Color.UpdateIfNeeds(this, value);
2136 NotifyPropertyChanged();
2141 /// Set the layout on this View. Replaces any existing Layout.
2143 /// <since_tizen> 6 </since_tizen>
2144 public LayoutItem Layout
2152 // Do nothing if layout provided is already set on this View.
2153 if (value == layout)
2158 LayoutingDisabled = false;
2161 // If new layout being set already has a owner then that owner receives a replacement default layout.
2162 // First check if the layout to be set already has a owner.
2163 if (value?.Owner != null)
2165 // Previous owner of the layout gets a default layout as a replacement.
2166 value.Owner.Layout = new AbsoluteLayout();
2168 // Copy Margin and Padding to replacement LayoutGroup.
2169 if (value.Owner.Layout != null)
2171 value.Owner.Layout.Margin = value.Margin;
2172 value.Owner.Layout.Padding = value.Padding;
2176 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2177 // View if no replacement. Previously margin and padding values would have been moved from
2178 // the View to the layout.
2179 if (layout != null) // Existing layout
2183 // Existing layout being replaced so copy over margin and padding values.
2184 value.Margin = layout.Margin;
2185 value.Padding = layout.Padding;
2189 // Layout not being replaced so restore margin and padding to View.
2190 SetValue(MarginProperty, layout.Margin);
2191 SetValue(PaddingProperty, layout.Padding);
2192 NotifyPropertyChanged();
2197 // First Layout to be added to the View hence copy
2199 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2202 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2204 // If View already has a margin set then store it in Layout instead.
2205 value.Margin = Margin;
2206 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2207 NotifyPropertyChanged();
2210 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2212 // If View already has a padding set then store it in Layout instead.
2213 value.Padding = Padding;
2214 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2215 NotifyPropertyChanged();
2220 // Remove existing layout from it's parent layout group.
2223 value.SetPositionByLayout = !excludeLayouting;
2225 // Set layout to this view
2231 /// The weight of the View, used to share available space in a layout with siblings.
2233 /// <since_tizen> 6 </since_tizen>
2243 layout?.RequestLayout();
2248 /// Whether to load the BackgroundImage synchronously.
2249 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2250 /// Note: For Normal Quad images only.
2252 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2253 [EditorBrowsable(EditorBrowsableState.Never)]
2254 public bool BackgroundImageSynchronosLoading
2258 return backgroundImageSynchronosLoading;
2262 backgroundImageSynchronosLoading = value;
2264 string bgUrl = null;
2265 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2267 if (!string.IsNullOrEmpty(bgUrl))
2269 PropertyMap bgMap = this.Background;
2270 bgMap.Add("synchronousLoading", new PropertyValue(backgroundImageSynchronosLoading));
2276 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2277 [EditorBrowsable(EditorBrowsableState.Never)]
2278 public Vector2 UpdateSizeHint
2282 return (Vector2)GetValue(UpdateSizeHintProperty);
2286 SetValue(UpdateSizeHintProperty, value);
2287 NotifyPropertyChanged();
2291 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2292 [EditorBrowsable(EditorBrowsableState.Never)]
2293 public string[] TransitionNames
2297 return transitionNames;
2301 transitionNames = value;
2307 /// Enable/Disable ControlState propagation for children.
2308 /// It is false by default.
2309 /// If the View needs to share ControlState with descendants, please set it true.
2310 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2312 [EditorBrowsable(EditorBrowsableState.Never)]
2313 public bool EnableControlStatePropagation
2315 get => controlStatePropagation;
2318 controlStatePropagation = value;
2320 foreach (View child in Children)
2322 child.EnableControlStatePropagation = value;
2328 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2329 /// By default, it is false in View, true in Control.
2330 /// Note that if the value is true, the View will be a touch receptor.
2332 [EditorBrowsable(EditorBrowsableState.Never)]
2333 public bool EnableControlState
2337 return (bool)GetValue(EnableControlStateProperty);
2341 SetValue(EnableControlStateProperty, value);
2346 /// Whether the actor grab all touches even if touch leaves its boundary.
2348 /// <returns>true, if it grab all touch after start</returns>
2349 [EditorBrowsable(EditorBrowsableState.Never)]
2350 public bool GrabTouchAfterLeave
2355 GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp);
2360 SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value));
2361 NotifyPropertyChanged();
2366 /// Determines which blend equation will be used to render renderers of this actor.
2368 /// <returns>blend equation enum currently assigned</returns>
2369 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2370 [EditorBrowsable(EditorBrowsableState.Never)]
2371 public BlendEquationType BlendEquation
2376 GetProperty(View.Property.BlendEquation).Get(out temp);
2377 return (BlendEquationType)temp;
2381 SetProperty(View.Property.BlendEquation, new Tizen.NUI.PropertyValue((int)value));
2382 NotifyPropertyChanged();
2387 /// If the value is true, the View will change its style as the theme changes.
2388 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2390 [EditorBrowsable(EditorBrowsableState.Never)]
2391 public bool ThemeChangeSensitive
2393 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2394 set => SetValue(ThemeChangeSensitiveProperty, value);
2398 /// Get Style, it is abstract function and must be override.
2400 /// <since_tizen> 6 </since_tizen>
2401 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2402 // TODO: It should be deprecated. please use CreateViewStyle instead.
2403 [EditorBrowsable(EditorBrowsableState.Never)]
2404 protected virtual ViewStyle GetViewStyle()
2406 return CreateViewStyle();
2410 /// Create Style, it is abstract function and must be override.
2412 [EditorBrowsable(EditorBrowsableState.Never)]
2413 protected virtual ViewStyle CreateViewStyle()
2415 return new ViewStyle();
2419 /// Called after the View's ControlStates changed.
2421 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2422 [EditorBrowsable(EditorBrowsableState.Never)]
2423 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2429 [EditorBrowsable(EditorBrowsableState.Never)]
2430 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2435 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2436 [EditorBrowsable(EditorBrowsableState.Never)]
2437 public virtual void ApplyStyle(ViewStyle viewStyle)
2439 if (null == viewStyle || this.viewStyle == viewStyle) return;
2441 this.viewStyle = viewStyle;
2443 Dictionary<string, BindableProperty> bindablePropertyOfView;
2444 Type viewType = GetType();
2446 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2447 Type styleType = viewStyle.GetType();
2449 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2450 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2452 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2454 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2456 BindableProperty viewProperty;
2457 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2459 if (null != viewProperty && viewProperty != StyleNameProperty)
2461 object value = viewStyle.GetValue(keyValuePair.Value);
2465 SetValue(viewProperty, value);