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;
64 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
65 internal BackgroundExtraData backgroundExtraData;
70 /// The Style instance binded with this View.
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 protected ViewStyle viewStyle;
75 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
76 [EditorBrowsable(EditorBrowsableState.Never)]
77 public ViewStyle ViewStyle
81 if (null == viewStyle)
83 ApplyStyle(GetViewStyle());
91 /// Creates a new instance of a view.
93 /// <since_tizen> 3 </since_tizen>
94 public View() : this(Interop.View.View_New(), true)
96 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
100 [EditorBrowsable(EditorBrowsableState.Never)]
101 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
103 this.ViewStyle.CopyFrom(viewStyle);
107 /// Create a new instance of a View with setting the status of shown or hidden.
109 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
110 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public View(bool shown) : this(Interop.View.View_New(), true)
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
129 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
131 if (this.viewStyle == null)
133 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
137 this.viewStyle.CopyFrom(viewStyle);
141 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
145 PositionUsesPivotPoint = false;
148 _onWindowSendEventCallback = SendViewAddedEventToWindow;
149 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
157 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 /// The event that is triggered when the View's ControlState is changed.
170 [EditorBrowsable(EditorBrowsableState.Never)]
171 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
173 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
175 private ControlStates controlStates;
177 /// Get/Set the control state.
179 /// <since_tizen> 6 </since_tizen>
180 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
181 [EditorBrowsable(EditorBrowsableState.Never)]
182 public ControlStates ControlState
186 return controlStates;
190 if (controlStates == value)
195 var prevState = controlStates;
197 controlStates = value;
199 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
201 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
203 OnControlStateChanged(changeInfo);
205 if (controlStatePropagation)
207 foreach (View child in Children)
209 child.ControlState = value;
213 ControlStateChangedEvent?.Invoke(this, changeInfo);
217 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public bool IsResourcesCreated
223 return Application.Current.IsResourcesCreated;
227 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
228 [EditorBrowsable(EditorBrowsableState.Never)]
229 public ResourceDictionary XamlResources
233 return Application.Current.XamlResources;
237 Application.Current.XamlResources = value;
242 /// The StyleName, type string.
244 /// <since_tizen> 3 </since_tizen>
245 public string StyleName
249 return (string)GetValue(StyleNameProperty);
253 SetValue(StyleNameProperty, value);
254 NotifyPropertyChanged();
259 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
262 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
264 /// <since_tizen> 3 </since_tizen>
265 public Color BackgroundColor
269 Color temp = (Color)GetValue(BackgroundColorProperty);
270 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
274 if (viewStyle != null)
276 viewStyle.BackgroundImage = null;
277 viewStyle.BackgroundColor = value;
281 SetValue(BackgroundColorProperty, value);
284 NotifyPropertyChanged();
289 /// The mutually exclusive with "backgroundColor" and "background" type Map.
291 /// <since_tizen> 3 </since_tizen>
292 public string BackgroundImage
296 return (string)GetValue(BackgroundImageProperty);
300 if (viewStyle != null)
302 viewStyle.BackgroundColor = null;
303 viewStyle.BackgroundImage = value;
307 SetValue(BackgroundImageProperty, value);
310 NotifyPropertyChanged();
315 /// Get or set the border of background image.
317 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
318 [EditorBrowsable(EditorBrowsableState.Never)]
319 public Rectangle BackgroundImageBorder
323 return (Rectangle)GetValue(BackgroundImageBorderProperty);
327 if (viewStyle != null)
329 viewStyle.BackgroundImageBorder = value;
333 SetValue(BackgroundImageBorderProperty, value);
336 NotifyPropertyChanged();
341 /// The background of view.
343 /// <since_tizen> 3 </since_tizen>
344 public Tizen.NUI.PropertyMap Background
348 return (PropertyMap)GetValue(BackgroundProperty);
352 SetValue(BackgroundProperty, value);
353 NotifyPropertyChanged();
358 /// Describes a shadow as an image for a View.
359 /// It is null by default.
362 /// Gettter returns copied instance of current shadow.
365 /// The mutually exclusive with "BoxShadow".
367 [EditorBrowsable(EditorBrowsableState.Never)]
368 public ImageShadow ImageShadow
372 return (ImageShadow)GetValue(ImageShadowProperty);
376 SetValue(ImageShadowProperty, value);
377 NotifyPropertyChanged();
382 /// Describes a box shaped shadow drawing for a View.
383 /// It is null by default.
386 /// Gettter returns copied instance of current shadow.
389 /// The mutually exclusive with "ImageShadow".
391 [EditorBrowsable(EditorBrowsableState.Never)]
392 public Shadow BoxShadow
396 return (Shadow)GetValue(BoxShadowProperty);
400 SetValue(BoxShadowProperty, value);
401 NotifyPropertyChanged();
406 /// The radius for the rounded corners of the View.
407 /// This will rounds background and shadow edges.
408 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
410 [EditorBrowsable(EditorBrowsableState.Never)]
411 public float CornerRadius
415 return (float)GetValue(CornerRadiusProperty);
419 SetValue(CornerRadiusProperty, value);
420 NotifyPropertyChanged();
425 /// The current state of the view.
427 /// <since_tizen> 3 </since_tizen>
432 return (States)GetValue(StateProperty);
436 SetValue(StateProperty, value);
437 NotifyPropertyChanged();
442 /// The current sub state of the view.
444 /// <since_tizen> 3 </since_tizen>
445 public States SubState
449 return (States)GetValue(SubStateProperty);
453 SetValue(SubStateProperty, value);
454 NotifyPropertyChanged();
459 /// Displays a tooltip
461 /// <since_tizen> 3 </since_tizen>
462 public Tizen.NUI.PropertyMap Tooltip
466 return (PropertyMap)GetValue(TooltipProperty);
470 SetValue(TooltipProperty, value);
471 NotifyPropertyChanged();
476 /// Displays a tooltip as a text.
478 /// <since_tizen> 3 </since_tizen>
479 public string TooltipText
483 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
484 NotifyPropertyChanged();
489 /// The Child property of FlexContainer.<br />
490 /// The proportion of the free space in the container, the flex item will receive.<br />
491 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
493 /// <since_tizen> 3 </since_tizen>
498 return (float)GetValue(FlexProperty);
502 SetValue(FlexProperty, value);
503 NotifyPropertyChanged();
508 /// The Child property of FlexContainer.<br />
509 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
511 /// <since_tizen> 3 </since_tizen>
516 return (int)GetValue(AlignSelfProperty);
520 SetValue(AlignSelfProperty, value);
521 NotifyPropertyChanged();
526 /// The Child property of FlexContainer.<br />
527 /// The space around the flex item.<br />
530 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
532 /// <since_tizen> 3 </since_tizen>
533 public Vector4 FlexMargin
537 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
538 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
542 SetValue(FlexMarginProperty, value);
543 NotifyPropertyChanged();
548 /// The top-left cell this child occupies, if not set, the first available cell is used.
551 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
553 /// <since_tizen> 3 </since_tizen>
554 public Vector2 CellIndex
558 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
559 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
563 SetValue(CellIndexProperty, value);
564 NotifyPropertyChanged();
569 /// The number of rows this child occupies, if not set, the default value is 1.
571 /// <since_tizen> 3 </since_tizen>
576 return (float)GetValue(RowSpanProperty);
580 SetValue(RowSpanProperty, value);
581 NotifyPropertyChanged();
586 /// The number of columns this child occupies, if not set, the default value is 1.
588 /// <since_tizen> 3 </since_tizen>
589 public float ColumnSpan
593 return (float)GetValue(ColumnSpanProperty);
597 SetValue(ColumnSpanProperty, value);
598 NotifyPropertyChanged();
603 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
605 /// <since_tizen> 3 </since_tizen>
606 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
610 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
614 SetValue(CellHorizontalAlignmentProperty, value);
615 NotifyPropertyChanged();
620 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
622 /// <since_tizen> 3 </since_tizen>
623 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
627 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
631 SetValue(CellVerticalAlignmentProperty, value);
632 NotifyPropertyChanged();
637 /// The left focusable view.<br />
638 /// This will return null if not set.<br />
639 /// This will also return null if the specified left focusable view is not on a window.<br />
641 /// <since_tizen> 3 </since_tizen>
642 public View LeftFocusableView
644 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
647 return (View)GetValue(LeftFocusableViewProperty);
651 SetValue(LeftFocusableViewProperty, value);
652 NotifyPropertyChanged();
657 /// The right focusable view.<br />
658 /// This will return null if not set.<br />
659 /// This will also return null if the specified right focusable view is not on a window.<br />
661 /// <since_tizen> 3 </since_tizen>
662 public View RightFocusableView
664 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
667 return (View)GetValue(RightFocusableViewProperty);
671 SetValue(RightFocusableViewProperty, value);
672 NotifyPropertyChanged();
677 /// The up focusable view.<br />
678 /// This will return null if not set.<br />
679 /// This will also return null if the specified up focusable view is not on a window.<br />
681 /// <since_tizen> 3 </since_tizen>
682 public View UpFocusableView
684 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
687 return (View)GetValue(UpFocusableViewProperty);
691 SetValue(UpFocusableViewProperty, value);
692 NotifyPropertyChanged();
697 /// The down focusable view.<br />
698 /// This will return null if not set.<br />
699 /// This will also return null if the specified down focusable view is not on a window.<br />
701 /// <since_tizen> 3 </since_tizen>
702 public View DownFocusableView
704 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
707 return (View)GetValue(DownFocusableViewProperty);
711 SetValue(DownFocusableViewProperty, value);
712 NotifyPropertyChanged();
717 /// Whether the view should be focusable by keyboard navigation.
719 /// <since_tizen> 3 </since_tizen>
720 public bool Focusable
724 SetValue(FocusableProperty, value);
725 NotifyPropertyChanged();
729 return (bool)GetValue(FocusableProperty);
734 /// Retrieves the position of the view.<br />
735 /// The coordinates are relative to the view's parent.<br />
737 /// <since_tizen> 3 </since_tizen>
738 public Position CurrentPosition
742 return GetCurrentPosition();
747 /// Sets the size of a view for the width and the height.<br />
748 /// Geometry can be scaled to fit within this area.<br />
749 /// This does not interfere with the view's scale factor.<br />
750 /// The views default depth is the minimum of width and height.<br />
753 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
754 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
756 /// <since_tizen> 3 </since_tizen>
761 Size2D temp = (Size2D)GetValue(Size2DProperty);
762 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
766 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
767 SetValue(Size2DProperty, value);
768 // Set Specification so when layouts measure this View it matches the value set here.
769 // All Views are currently Layouts.
770 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
771 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
772 _widthPolicy = value.Width;
773 _heightPolicy = value.Height;
774 _layout?.RequestLayout();
775 NotifyPropertyChanged();
780 /// Retrieves the size of the view.<br />
781 /// The coordinates are relative to the view's parent.<br />
783 /// <since_tizen> 3 </since_tizen>
784 public Size2D CurrentSize
788 return GetCurrentSize();
793 /// Retrieves and sets the view's opacity.<br />
795 /// <since_tizen> 3 </since_tizen>
800 return (float)GetValue(OpacityProperty);
804 if (viewStyle != null)
806 viewStyle.Opacity = value;
810 SetValue(OpacityProperty, value);
813 NotifyPropertyChanged();
818 /// Sets the position of the view for X and Y.<br />
819 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
820 /// If the position inheritance is disabled, sets the world position.<br />
823 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
824 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
826 /// <since_tizen> 3 </since_tizen>
827 public Position2D Position2D
831 Position2D temp = (Position2D)GetValue(Position2DProperty);
832 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
836 SetValue(Position2DProperty, value);
837 NotifyPropertyChanged();
842 /// Retrieves the screen postion of the view.<br />
844 /// <since_tizen> 3 </since_tizen>
845 public Vector2 ScreenPosition
849 Vector2 temp = new Vector2(0.0f, 0.0f);
850 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
856 /// Determines whether the pivot point should be used to determine the position of the view.
857 /// This is true by default.
859 /// <remarks>If false, then the top-left of the view is used for the position.
860 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
862 /// <since_tizen> 3 </since_tizen>
863 public bool PositionUsesPivotPoint
867 return (bool)GetValue(PositionUsesPivotPointProperty);
871 SetValue(PositionUsesPivotPointProperty, value);
872 NotifyPropertyChanged();
877 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
879 /// <since_tizen> 3 </since_tizen>
880 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
882 "View view = new View(); " +
883 "view.PivotPoint = PivotPoint.Center; " +
884 "view.PositionUsesPivotPoint = true;" +
885 " Deprecated in API5: Will be removed in API8")]
886 [EditorBrowsable(EditorBrowsableState.Never)]
887 public bool PositionUsesAnchorPoint
892 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
897 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
898 NotifyPropertyChanged();
903 /// Queries whether the view is connected to the stage.<br />
904 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
906 /// <since_tizen> 3 </since_tizen>
907 public bool IsOnWindow
916 /// Gets the depth in the hierarchy for the view.
918 /// <since_tizen> 3 </since_tizen>
919 public int HierarchyDepth
923 return GetHierarchyDepth();
928 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
931 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
932 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
933 /// The values set by this property will likely change.
935 /// <since_tizen> 3 </since_tizen>
936 public int SiblingOrder
940 return (int)GetValue(SiblingOrderProperty);
944 SetValue(SiblingOrderProperty, value);
946 LayoutGroup layout = Layout as LayoutGroup;
947 layout?.ChangeLayoutSiblingOrder(value);
949 NotifyPropertyChanged();
954 /// Returns the natural size of the view.
957 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
959 /// <since_tizen> 5 </since_tizen>
960 public Vector3 NaturalSize
964 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
965 if (NDalicPINVOKE.SWIGPendingException.Pending)
966 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
972 /// Returns the natural size (Size2D) of the view.
975 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
977 /// <since_tizen> 4 </since_tizen>
978 public Size2D NaturalSize2D
982 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
983 if (NDalicPINVOKE.SWIGPendingException.Pending)
984 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
986 return new Size2D((int)temp.Width, (int)temp.Height);
991 /// Gets or sets the origin of a view within its parent's area.<br />
992 /// 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 />
993 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
994 /// A view's position is the distance between this origin and the view's anchor-point.<br />
996 /// <pre>The view has been initialized.</pre>
997 /// <since_tizen> 3 </since_tizen>
998 public Position ParentOrigin
1002 Position tmp = (Position)GetValue(ParentOriginProperty);
1003 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1007 SetValue(ParentOriginProperty, value);
1008 NotifyPropertyChanged();
1013 /// Gets or sets the anchor-point of a view.<br />
1014 /// 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 />
1015 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1016 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1017 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1018 /// <pre>The view has been initialized.</pre>
1021 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1023 /// <since_tizen> 3 </since_tizen>
1024 public Position PivotPoint
1028 Position tmp = (Position)GetValue(PivotPointProperty);
1029 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1033 SetValue(PivotPointProperty, value);
1034 NotifyPropertyChanged();
1039 /// Gets or sets the size width of the view.
1043 /// Animatable - This property can be animated using <c>Animation</c> class.
1046 /// <since_tizen> 3 </since_tizen>
1047 public float SizeWidth
1051 return (float)GetValue(SizeWidthProperty);
1055 SetValue(SizeWidthProperty, value);
1056 WidthSpecification = (int)Math.Ceiling(value);
1057 NotifyPropertyChanged();
1062 /// Gets or sets the size height of the view.
1066 /// Animatable - This property can be animated using <c>Animation</c> class.
1069 /// <since_tizen> 3 </since_tizen>
1070 public float SizeHeight
1074 return (float)GetValue(SizeHeightProperty);
1078 SetValue(SizeHeightProperty, value);
1079 HeightSpecification = (int)Math.Ceiling(value);
1080 NotifyPropertyChanged();
1085 /// Gets or sets the position of the view.<br />
1086 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1087 /// If the position inheritance is disabled, sets the world position.<br />
1091 /// Animatable - This property can be animated using <c>Animation</c> class.
1093 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1095 /// <since_tizen> 3 </since_tizen>
1096 public Position Position
1100 Position tmp = (Position)GetValue(PositionProperty);
1101 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1105 SetValue(PositionProperty, value);
1106 NotifyPropertyChanged();
1111 /// Gets or sets the position X of the view.
1115 /// Animatable - This property can be animated using <c>Animation</c> class.
1118 /// <since_tizen> 3 </since_tizen>
1119 public float PositionX
1123 return (float)GetValue(PositionXProperty);
1127 SetValue(PositionXProperty, value);
1128 NotifyPropertyChanged();
1133 /// Gets or sets the position Y of the view.
1137 /// Animatable - This property can be animated using <c>Animation</c> class.
1140 /// <since_tizen> 3 </since_tizen>
1141 public float PositionY
1145 return (float)GetValue(PositionYProperty);
1149 SetValue(PositionYProperty, value);
1150 NotifyPropertyChanged();
1155 /// Gets or sets the position Z of the view.
1159 /// Animatable - This property can be animated using <c>Animation</c> class.
1162 /// <since_tizen> 3 </since_tizen>
1163 public float PositionZ
1167 return (float)GetValue(PositionZProperty);
1171 SetValue(PositionZProperty, value);
1172 NotifyPropertyChanged();
1177 /// Gets or sets the world position of the view.
1179 /// <since_tizen> 3 </since_tizen>
1180 public Vector3 WorldPosition
1184 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1185 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1191 /// Gets or sets the orientation of the view.<br />
1192 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1196 /// This is an asynchronous method.
1199 /// Animatable - This property can be animated using <c>Animation</c> class.
1202 /// <since_tizen> 3 </since_tizen>
1203 public Rotation Orientation
1207 return (Rotation)GetValue(OrientationProperty);
1211 SetValue(OrientationProperty, value);
1212 NotifyPropertyChanged();
1217 /// Gets or sets the world orientation of the view.<br />
1219 /// <since_tizen> 3 </since_tizen>
1220 public Rotation WorldOrientation
1224 Rotation temp = new Rotation();
1225 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1231 /// Gets or sets the scale factor applied to the view.<br />
1235 /// Animatable - This property can be animated using <c>Animation</c> class.
1237 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1239 /// <since_tizen> 3 </since_tizen>
1240 public Vector3 Scale
1244 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1245 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1249 SetValue(ScaleProperty, value);
1250 NotifyPropertyChanged();
1255 /// Gets or sets the scale X factor applied to the view.
1259 /// Animatable - This property can be animated using <c>Animation</c> class.
1262 /// <since_tizen> 3 </since_tizen>
1267 return (float)GetValue(ScaleXProperty);
1271 SetValue(ScaleXProperty, value);
1272 NotifyPropertyChanged();
1277 /// Gets or sets the scale Y factor applied to the view.
1281 /// Animatable - This property can be animated using <c>Animation</c> class.
1284 /// <since_tizen> 3 </since_tizen>
1289 return (float)GetValue(ScaleYProperty);
1293 SetValue(ScaleYProperty, value);
1294 NotifyPropertyChanged();
1299 /// Gets or sets the scale Z factor applied to the view.
1303 /// Animatable - This property can be animated using <c>Animation</c> class.
1306 /// <since_tizen> 3 </since_tizen>
1311 return (float)GetValue(ScaleZProperty);
1315 SetValue(ScaleZProperty, value);
1316 NotifyPropertyChanged();
1321 /// Gets the world scale of the view.
1323 /// <since_tizen> 3 </since_tizen>
1324 public Vector3 WorldScale
1328 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1329 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1335 /// Retrieves the visibility flag of the view.
1339 /// If the view is not visible, then the view and its children will not be rendered.
1340 /// 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.
1343 /// Animatable - This property can be animated using <c>Animation</c> class.
1346 /// <since_tizen> 3 </since_tizen>
1347 public bool Visibility
1352 GetProperty(View.Property.VISIBLE).Get(out temp);
1358 /// Gets the view's world color.
1360 /// <since_tizen> 3 </since_tizen>
1361 public Vector4 WorldColor
1365 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1366 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1372 /// Gets or sets the view's name.
1374 /// <since_tizen> 3 </since_tizen>
1379 return (string)GetValue(NameProperty);
1383 SetValue(NameProperty, value);
1384 NotifyPropertyChanged();
1389 /// Get the number of children held by the view.
1391 /// <since_tizen> 3 </since_tizen>
1392 public new uint ChildCount
1396 return GetChildCount();
1401 /// Gets the view's ID.
1404 /// <since_tizen> 3 </since_tizen>
1414 /// Gets or sets the status of whether the view should emit touch or hover signals.
1416 /// <since_tizen> 3 </since_tizen>
1417 public bool Sensitive
1421 return (bool)GetValue(SensitiveProperty);
1425 SetValue(SensitiveProperty, value);
1426 NotifyPropertyChanged();
1431 /// 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.
1433 /// <since_tizen> 3 </since_tizen>
1434 public bool LeaveRequired
1438 return (bool)GetValue(LeaveRequiredProperty);
1442 SetValue(LeaveRequiredProperty, value);
1443 NotifyPropertyChanged();
1448 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1450 /// <since_tizen> 3 </since_tizen>
1451 public bool InheritOrientation
1455 return (bool)GetValue(InheritOrientationProperty);
1459 SetValue(InheritOrientationProperty, value);
1460 NotifyPropertyChanged();
1465 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1467 /// <since_tizen> 3 </since_tizen>
1468 public bool InheritScale
1472 return (bool)GetValue(InheritScaleProperty);
1476 SetValue(InheritScaleProperty, value);
1477 NotifyPropertyChanged();
1482 /// Gets or sets the status of how the view and its children should be drawn.<br />
1483 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1484 /// 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 />
1485 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1486 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1487 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1489 /// <since_tizen> 3 </since_tizen>
1490 public DrawModeType DrawMode
1494 return (DrawModeType)GetValue(DrawModeProperty);
1498 SetValue(DrawModeProperty, value);
1499 NotifyPropertyChanged();
1504 /// Gets or sets the relative to parent size factor of the view.<br />
1505 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1506 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1509 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1511 /// <since_tizen> 3 </since_tizen>
1512 public Vector3 SizeModeFactor
1516 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1517 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1521 SetValue(SizeModeFactorProperty, value);
1522 NotifyPropertyChanged();
1527 /// Gets or sets the width resize policy to be used.
1529 /// <since_tizen> 3 </since_tizen>
1530 public ResizePolicyType WidthResizePolicy
1534 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1538 SetValue(WidthResizePolicyProperty, value);
1539 // Match ResizePolicy to new Layouting.
1540 // Parent relative policies can not be mapped at this point as parent size unknown.
1543 case ResizePolicyType.UseNaturalSize:
1545 WidthSpecification = LayoutParamPolicies.WrapContent;
1548 case ResizePolicyType.FillToParent:
1550 WidthSpecification = LayoutParamPolicies.MatchParent;
1553 case ResizePolicyType.FitToChildren:
1555 WidthSpecification = LayoutParamPolicies.WrapContent;
1561 NotifyPropertyChanged();
1566 /// Gets or sets the height resize policy to be used.
1568 /// <since_tizen> 3 </since_tizen>
1569 public ResizePolicyType HeightResizePolicy
1573 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1577 SetValue(HeightResizePolicyProperty, value);
1578 // Match ResizePolicy to new Layouting.
1579 // Parent relative policies can not be mapped at this point as parent size unknown.
1582 case ResizePolicyType.UseNaturalSize:
1584 HeightSpecification = LayoutParamPolicies.WrapContent;
1587 case ResizePolicyType.FillToParent:
1589 HeightSpecification = LayoutParamPolicies.MatchParent;
1592 case ResizePolicyType.FitToChildren:
1594 HeightSpecification = LayoutParamPolicies.WrapContent;
1600 NotifyPropertyChanged();
1605 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1606 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1608 /// <since_tizen> 3 </since_tizen>
1609 public SizeScalePolicyType SizeScalePolicy
1613 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1617 SetValue(SizeScalePolicyProperty, value);
1618 NotifyPropertyChanged();
1623 /// Gets or sets the status of whether the width size is dependent on the height size.
1625 /// <since_tizen> 3 </since_tizen>
1626 public bool WidthForHeight
1630 return (bool)GetValue(WidthForHeightProperty);
1634 SetValue(WidthForHeightProperty, value);
1635 NotifyPropertyChanged();
1640 /// Gets or sets the status of whether the height size is dependent on the width size.
1642 /// <since_tizen> 3 </since_tizen>
1643 public bool HeightForWidth
1647 return (bool)GetValue(HeightForWidthProperty);
1651 SetValue(HeightForWidthProperty, value);
1652 NotifyPropertyChanged();
1657 /// Gets or sets the padding for use in layout.
1660 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1662 /// <since_tizen> 5 </since_tizen>
1663 public Extents Padding
1667 // If View has a Layout then padding in stored in the base Layout class
1670 return Layout.Padding;
1674 Extents temp = (Extents)GetValue(PaddingProperty);
1675 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1677 // Two return points to prevent creating a zeroed Extent native object before assignment
1681 Extents padding = value;
1684 // Layout set so store Padding in LayoutItem instead of in View.
1685 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1686 // the position and sizes measure in the Layouting.
1687 Layout.Padding = value;
1688 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1689 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1690 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1692 padding = new Extents(0,0,0,0); // Reset value stored in View.
1694 _layout?.RequestLayout();
1696 SetValue(PaddingProperty, padding);
1697 NotifyPropertyChanged();
1698 _layout?.RequestLayout();
1703 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1706 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1708 /// <since_tizen> 3 </since_tizen>
1709 public Size2D MinimumSize
1713 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1714 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1718 if (_layout != null)
1720 // Note: it only works if minimum size is >= than natural size.
1721 // To force the size it should be done through the width&height spec or Size2D.
1722 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1723 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1724 _layout.RequestLayout();
1726 SetValue(MinimumSizeProperty, value);
1727 NotifyPropertyChanged();
1732 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1735 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1737 /// <since_tizen> 3 </since_tizen>
1738 public Size2D MaximumSize
1742 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1743 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1747 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1748 // MATCH_PARENT spec + parent container size can be used to limit
1749 if (_layout != null)
1751 _layout.RequestLayout();
1753 SetValue(MaximumSizeProperty, value);
1754 NotifyPropertyChanged();
1759 /// Gets or sets whether a child view inherits it's parent's position.<br />
1760 /// Default is to inherit.<br />
1761 /// 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 />
1763 /// <since_tizen> 3 </since_tizen>
1764 public bool InheritPosition
1768 return (bool)GetValue(InheritPositionProperty);
1772 SetValue(InheritPositionProperty, value);
1773 NotifyPropertyChanged();
1778 /// Gets or sets the clipping behavior (mode) of it's children.
1780 /// <since_tizen> 3 </since_tizen>
1781 public ClippingModeType ClippingMode
1785 return (ClippingModeType)GetValue(ClippingModeProperty);
1789 SetValue(ClippingModeProperty, value);
1790 NotifyPropertyChanged();
1795 /// Gets the number of renderers held by the view.
1797 /// <since_tizen> 3 </since_tizen>
1798 public uint RendererCount
1802 return GetRendererCount();
1807 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1810 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1812 /// <since_tizen> 3 </since_tizen>
1813 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1815 "View view = new View(); " +
1816 "view.PivotPoint = PivotPoint.Center; " +
1817 "view.PositionUsesPivotPoint = true;")]
1818 [EditorBrowsable(EditorBrowsableState.Never)]
1819 public Position AnchorPoint
1823 Position temp = new Position(0.0f, 0.0f, 0.0f);
1824 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1825 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1829 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1830 NotifyPropertyChanged();
1835 /// Sets the size of a view for the width, the height and the depth.<br />
1836 /// Geometry can be scaled to fit within this area.<br />
1837 /// This does not interfere with the view's scale factor.<br />
1838 /// The views default depth is the minimum of width and height.<br />
1842 /// Animatable - This property can be animated using <c>Animation</c> class.
1844 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1846 /// <since_tizen> 5 </since_tizen>
1851 Size tmp = (Size)GetValue(SizeProperty);
1852 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1856 SetValue(SizeProperty, value);
1857 // Set Specification so when layouts measure this View it matches the value set here.
1858 // All Views are currently Layouts.
1859 WidthSpecification = (int)Math.Ceiling(value.Width);
1860 HeightSpecification = (int)Math.Ceiling(value.Height);
1861 NotifyPropertyChanged();
1866 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1868 /// <since_tizen> 3 </since_tizen>
1869 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1871 "Container parent = view.GetParent(); " +
1872 "View view = parent as View;")]
1873 [EditorBrowsable(EditorBrowsableState.Never)]
1874 public new View Parent
1879 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1880 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1881 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1883 if (basehandle is Layer layer)
1885 ret = new View(Layer.getCPtr(layer).Handle, false);
1886 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1890 ret = basehandle as View;
1893 Interop.BaseHandle.delete_BaseHandle(CPtr);
1894 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1896 if (NDalicPINVOKE.SWIGPendingException.Pending)
1897 throw 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
1991 return _widthPolicy;
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 Size2D.Width = _widthPolicy;
2008 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
2009 // Size2D height will store the specification value (negative number) this will then be applied to the
2010 // HeightSpecification when the Size2D callback is invoked.
2011 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2014 _layout?.RequestLayout();
2015 _oldWidthPolicy = _widthPolicy;
2021 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2023 /// <since_tizen> 6 </since_tizen>
2024 public int HeightSpecification
2028 return _heightPolicy;
2032 _heightPolicy = value;
2033 if( _oldHeightPolicy != _heightPolicy )
2035 if (_heightPolicy >= 0)
2037 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
2039 if(_widthPolicy>=0) // Policy an exact value
2041 Size2D.Height = _heightPolicy;
2045 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
2046 // Size2D height will store the specification value (negative number) this will then be applied to the
2047 // HeightSpecification when the Size2D callback is invoked.
2048 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2052 _layout?.RequestLayout();
2053 _oldHeightPolicy = _heightPolicy;
2059 /// Gets the List of transitions for this View.
2061 /// <since_tizen> 6 </since_tizen>
2062 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2066 if (_layoutTransitions == null)
2068 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2070 return _layoutTransitions;
2075 /// Set a layout transitions for this View.
2078 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2080 /// <since_tizen> 6 </since_tizen>
2081 public LayoutTransition LayoutTransition
2085 if (_layoutTransitions == null)
2087 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2089 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2091 AttachTransitionsToChildren(value);
2096 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2099 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2101 /// <since_tizen> 4 </since_tizen>
2102 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2103 [EditorBrowsable(EditorBrowsableState.Never)]
2104 public Extents PaddingEX
2108 Extents temp = new Extents(0, 0, 0, 0);
2109 GetProperty(View.Property.PADDING).Get(temp);
2110 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2114 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2115 NotifyPropertyChanged();
2116 _layout?.RequestLayout();
2120 /// <since_tizen> 6 </since_tizen>
2121 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2122 [EditorBrowsable(EditorBrowsableState.Never)]
2123 public Style XamlStyle
2127 return (Style)GetValue(XamlStyleProperty);
2131 SetValue(XamlStyleProperty, value);
2136 /// The Color of View. This is an RGBA value.
2140 /// Animatable - This property can be animated using <c>Animation</c> class.
2142 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2144 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2145 [EditorBrowsable(EditorBrowsableState.Never)]
2150 Color temp = (Color)GetValue(ColorProperty);
2151 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2155 if (viewStyle != null)
2157 viewStyle.Color = value;
2161 SetValue(ColorProperty, value);
2164 NotifyPropertyChanged();
2169 /// Set the layout on this View. Replaces any existing Layout.
2171 /// <since_tizen> 6 </since_tizen>
2172 public LayoutItem Layout
2180 // Do nothing if layout provided is already set on this View.
2181 if (value == _layout)
2186 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2187 layoutingDisabled = false;
2190 // If new layout being set already has a owner then that owner receives a replacement default layout.
2191 // First check if the layout to be set already has a owner.
2192 if (value?.Owner != null)
2194 // Previous owner of the layout gets a default layout as a replacement.
2195 value.Owner.Layout = new AbsoluteLayout();
2197 // Copy Margin and Padding to replacement LayoutGroup.
2198 value.Owner.Layout.Margin = value.Margin;
2199 value.Owner.Layout.Padding = value.Padding;
2202 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2203 // View if no replacement. Previously margin and padding values would have been moved from
2204 // the View to the layout.
2205 if (_layout != null ) // Existing layout
2209 // Existing layout being replaced so copy over margin and padding values.
2210 value.Margin = _layout.Margin;
2211 value.Padding = _layout.Padding;
2215 // Layout not being replaced so restore margin and padding to View.
2216 SetValue(MarginProperty, _layout.Margin);
2217 SetValue(PaddingProperty, _layout.Padding);
2218 NotifyPropertyChanged();
2223 // First Layout to be added to the View hence copy
2225 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2228 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2230 // If View already has a margin set then store it in Layout instead.
2231 value.Margin = Margin;
2232 SetValue(MarginProperty, new Extents(0,0,0,0));
2233 NotifyPropertyChanged();
2236 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2238 // If View already has a padding set then store it in Layout instead.
2239 value.Padding = Padding;
2240 SetValue(PaddingProperty, new Extents(0,0,0,0));
2241 NotifyPropertyChanged();
2246 // Remove existing layout from it's parent layout group.
2247 _layout?.Unparent();
2249 // Set layout to this view
2255 /// The weight of the View, used to share available space in a layout with siblings.
2257 /// <since_tizen> 6 </since_tizen>
2267 _layout?.RequestLayout();
2272 /// Whether to load the BackgroundImage synchronously.
2273 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2274 /// Note: For Normal Quad images only.
2276 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2277 [EditorBrowsable(EditorBrowsableState.Never)]
2278 public bool BackgroundImageSynchronosLoading
2282 return _backgroundImageSynchronosLoading;
2286 _backgroundImageSynchronosLoading = value;
2289 Background.Find(Visual.Property.Type)?.Get(out visualType);
2290 if (visualType == (int)Visual.Type.Image)
2292 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2295 if (bgUrl.Length != 0)
2297 PropertyMap bgMap = this.Background;
2298 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2304 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2305 [EditorBrowsable(EditorBrowsableState.Never)]
2306 public Vector2 UpdateSizeHint
2310 return (Vector2)GetValue(UpdateSizeHintProperty);
2314 SetValue(UpdateSizeHintProperty, value);
2315 NotifyPropertyChanged();
2319 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2320 [EditorBrowsable(EditorBrowsableState.Never)]
2321 public string[] TransitionNames
2325 return transitionNames;
2329 transitionNames = value;
2335 /// Enable/Disable ControlState propagation for children.
2336 /// It is false by default.
2337 /// If the View needs to share ControlState with descendants, please set it true.
2338 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2340 [EditorBrowsable(EditorBrowsableState.Never)]
2341 public bool EnableControlStatePropagation
2343 get => controlStatePropagation;
2346 controlStatePropagation = value;
2348 foreach (View child in Children)
2350 child.EnableControlStatePropagation = value;
2356 /// Get Style, it is abstract function and must be override.
2358 /// <since_tizen> 6 </since_tizen>
2359 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2360 [EditorBrowsable(EditorBrowsableState.Never)]
2361 protected virtual ViewStyle GetViewStyle()
2363 return new ViewStyle();
2367 /// Called after the View's ControlStates changed.
2369 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2370 [EditorBrowsable(EditorBrowsableState.Never)]
2371 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2375 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2377 var view = (View)bindable;
2378 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2380 defaultValueCreator: (bindable) =>
2382 var view = (View)bindable;
2383 return view.backgroundImageSelector;
2385 private TriggerableSelector<string> _backgroundImageSelector;
2386 private TriggerableSelector<string> backgroundImageSelector
2390 if (null == _backgroundImageSelector)
2392 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2394 return _backgroundImageSelector;
2397 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2399 var view = (View)bindable;
2400 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2402 defaultValueCreator: (bindable) =>
2404 var view = (View)bindable;
2405 return view.backgroundColorSelector;
2407 private TriggerableSelector<Color> _backgroundColorSelector;
2408 private TriggerableSelector<Color> backgroundColorSelector
2412 if (null == _backgroundColorSelector)
2414 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2416 return _backgroundColorSelector;
2420 internal static readonly BindableProperty ColorSelectorProperty = BindableProperty.Create("ColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2422 var view = (View)bindable;
2423 view.colorSelector.Clone((Selector<Color>)newValue);
2425 defaultValueCreator: (bindable) =>
2427 var view = (View)bindable;
2428 return view.colorSelector;
2431 private TriggerableSelector<Color> _colorSelector;
2432 private TriggerableSelector<Color> colorSelector
2436 if (null == _colorSelector)
2438 _colorSelector = new TriggerableSelector<Color>(this, ColorProperty);
2440 return _colorSelector;
2444 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2446 var view = (View)bindable;
2447 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2449 defaultValueCreator: (bindable) =>
2451 var view = (View)bindable;
2452 return view.backgroundImageBorderSelector;
2454 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2455 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2459 if (null == _backgroundImageBorderSelector)
2461 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2463 return _backgroundImageBorderSelector;
2466 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2468 var view = (View)bindable;
2469 view.opacitySelector.Clone((Selector<float?>)newValue);
2471 defaultValueCreator: (bindable) =>
2473 var view = (View)bindable;
2474 return view.opacitySelector;
2476 private TriggerableSelector<float?> _opacitySelector;
2477 private TriggerableSelector<float?> opacitySelector
2481 if (null == _opacitySelector)
2483 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2485 return _opacitySelector;
2489 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2490 [EditorBrowsable(EditorBrowsableState.Never)]
2491 public virtual void ApplyStyle(ViewStyle viewStyle)
2493 if (null == viewStyle)
2498 if (this.viewStyle == viewStyle)
2503 if (null != this.viewStyle)
2505 simpleBinding.Clear();
2508 this.viewStyle = viewStyle;
2510 Dictionary<string, BindableProperty> bindablePropertyOfView;
2511 Type viewType = GetType();
2513 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2514 Type styleType = viewStyle.GetType();
2516 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2517 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2519 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2521 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2523 BindableProperty viewProperty;
2524 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2526 if (null != viewProperty)
2528 object value = viewStyle.GetValue(keyValuePair.Value);
2532 SetValue(viewProperty, value);
2535 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2541 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2542 [EditorBrowsable(EditorBrowsableState.Never)]
2543 private BundledPipe simpleBinding = new BundledPipe();