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 float _weight = 0.0f; // Weighting of child View in a Layout
55 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
56 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
57 private bool _backgroundImageSynchronosLoading = false;
58 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
59 private string[] transitionNames;
60 private Rectangle backgroundImageBorder;
62 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
64 private ViewStyle viewStyle;
65 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
66 [EditorBrowsable(EditorBrowsableState.Never)]
67 public ViewStyle ViewStyle
71 if (null == viewStyle)
73 ApplyStyle(GetViewStyle());
81 /// Creates a new instance of a view.
83 /// <since_tizen> 3 </since_tizen>
84 public View() : this(Interop.View.View_New(), true)
86 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
90 [EditorBrowsable(EditorBrowsableState.Never)]
91 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
93 this.ViewStyle.CopyFrom(viewStyle);
97 /// Create a new instance of a View with setting the status of shown or hidden.
99 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
100 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
101 [EditorBrowsable(EditorBrowsableState.Never)]
102 public View(bool shown) : this(Interop.View.View_New(), true)
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
119 this.ViewStyle.CopyFrom(viewStyle);
122 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
126 PositionUsesPivotPoint = false;
129 _onWindowSendEventCallback = SendViewAddedEventToWindow;
130 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
138 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
140 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148 internal delegate void ControlStateChangesDelegate(View obj, ControlStates state);
149 internal event ControlStateChangesDelegate ControlStateChangeEvent;
151 private ControlStates controlStates;
153 /// Get/Set the control state.
155 /// <since_tizen> 6 </since_tizen>
156 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
157 [EditorBrowsable(EditorBrowsableState.Never)]
158 public ControlStates ControlState
162 return controlStates;
166 if (controlStates != value)
168 controlStates = value;
170 ControlStateChangeEvent?.Invoke(this, value);
172 if (true == OnControlStateChanged(value))
174 foreach (View child in Children)
176 child.ControlState = value;
183 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
184 [EditorBrowsable(EditorBrowsableState.Never)]
185 public bool IsResourcesCreated
189 return Application.Current.IsResourcesCreated;
193 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
194 [EditorBrowsable(EditorBrowsableState.Never)]
195 public ResourceDictionary XamlResources
199 return Application.Current.XamlResources;
203 Application.Current.XamlResources = value;
208 /// The StyleName, type string.
210 /// <since_tizen> 3 </since_tizen>
211 public string StyleName
215 return (string)GetValue(StyleNameProperty);
219 SetValue(StyleNameProperty, value);
220 NotifyPropertyChanged();
225 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
228 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
230 /// <since_tizen> 3 </since_tizen>
231 public Color BackgroundColor
235 Color temp = (Color)GetValue(BackgroundColorProperty);
236 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
240 SetValue(BackgroundColorProperty, value);
241 NotifyPropertyChanged();
246 /// The mutually exclusive with "backgroundColor" and "background" type Map.
248 /// <since_tizen> 3 </since_tizen>
249 public string BackgroundImage
253 return (string)GetValue(BackgroundImageProperty);
257 SetValue(BackgroundImageProperty, value);
258 NotifyPropertyChanged();
263 /// Get or set the border of background image.
265 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
266 [EditorBrowsable(EditorBrowsableState.Never)]
267 public Rectangle BackgroundImageBorder
271 return (Rectangle)GetValue(BackgroundImageBorderProperty);
275 SetValue(BackgroundImageBorderProperty, value);
276 NotifyPropertyChanged();
281 /// The background of view.
283 /// <since_tizen> 3 </since_tizen>
284 public Tizen.NUI.PropertyMap Background
288 return (PropertyMap)GetValue(BackgroundProperty);
292 SetValue(BackgroundProperty, value);
293 NotifyPropertyChanged();
298 /// The current state of the view.
300 /// <since_tizen> 3 </since_tizen>
305 return (States)GetValue(StateProperty);
309 SetValue(StateProperty, value);
310 NotifyPropertyChanged();
315 /// The current sub state of the view.
317 /// <since_tizen> 3 </since_tizen>
318 public States SubState
322 return (States)GetValue(SubStateProperty);
326 SetValue(SubStateProperty, value);
327 NotifyPropertyChanged();
332 /// Displays a tooltip
334 /// <since_tizen> 3 </since_tizen>
335 public Tizen.NUI.PropertyMap Tooltip
339 return (PropertyMap)GetValue(TooltipProperty);
343 SetValue(TooltipProperty, value);
344 NotifyPropertyChanged();
349 /// Displays a tooltip as a text.
351 /// <since_tizen> 3 </since_tizen>
352 public string TooltipText
356 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
357 NotifyPropertyChanged();
362 /// The Child property of FlexContainer.<br />
363 /// The proportion of the free space in the container, the flex item will receive.<br />
364 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
366 /// <since_tizen> 3 </since_tizen>
371 return (float)GetValue(FlexProperty);
375 SetValue(FlexProperty, value);
376 NotifyPropertyChanged();
381 /// The Child property of FlexContainer.<br />
382 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
384 /// <since_tizen> 3 </since_tizen>
389 return (int)GetValue(AlignSelfProperty);
393 SetValue(AlignSelfProperty, value);
394 NotifyPropertyChanged();
399 /// The Child property of FlexContainer.<br />
400 /// The space around the flex item.<br />
403 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
405 /// <since_tizen> 3 </since_tizen>
406 public Vector4 FlexMargin
410 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
411 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
415 SetValue(FlexMarginProperty, value);
416 NotifyPropertyChanged();
421 /// The top-left cell this child occupies, if not set, the first available cell is used.
424 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
426 /// <since_tizen> 3 </since_tizen>
427 public Vector2 CellIndex
431 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
432 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
436 SetValue(CellIndexProperty, value);
437 NotifyPropertyChanged();
442 /// The number of rows this child occupies, if not set, the default value is 1.
444 /// <since_tizen> 3 </since_tizen>
449 return (float)GetValue(RowSpanProperty);
453 SetValue(RowSpanProperty, value);
454 NotifyPropertyChanged();
459 /// The number of columns this child occupies, if not set, the default value is 1.
461 /// <since_tizen> 3 </since_tizen>
462 public float ColumnSpan
466 return (float)GetValue(ColumnSpanProperty);
470 SetValue(ColumnSpanProperty, value);
471 NotifyPropertyChanged();
476 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
478 /// <since_tizen> 3 </since_tizen>
479 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
483 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
487 SetValue(CellHorizontalAlignmentProperty, value);
488 NotifyPropertyChanged();
493 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
495 /// <since_tizen> 3 </since_tizen>
496 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
500 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
504 SetValue(CellVerticalAlignmentProperty, value);
505 NotifyPropertyChanged();
510 /// The left focusable view.<br />
511 /// This will return null if not set.<br />
512 /// This will also return null if the specified left focusable view is not on a window.<br />
514 /// <since_tizen> 3 </since_tizen>
515 public View LeftFocusableView
517 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
520 return (View)GetValue(LeftFocusableViewProperty);
524 SetValue(LeftFocusableViewProperty, value);
525 NotifyPropertyChanged();
530 /// The right focusable view.<br />
531 /// This will return null if not set.<br />
532 /// This will also return null if the specified right focusable view is not on a window.<br />
534 /// <since_tizen> 3 </since_tizen>
535 public View RightFocusableView
537 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
540 return (View)GetValue(RightFocusableViewProperty);
544 SetValue(RightFocusableViewProperty, value);
545 NotifyPropertyChanged();
550 /// The up focusable view.<br />
551 /// This will return null if not set.<br />
552 /// This will also return null if the specified up focusable view is not on a window.<br />
554 /// <since_tizen> 3 </since_tizen>
555 public View UpFocusableView
557 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
560 return (View)GetValue(UpFocusableViewProperty);
564 SetValue(UpFocusableViewProperty, value);
565 NotifyPropertyChanged();
570 /// The down focusable view.<br />
571 /// This will return null if not set.<br />
572 /// This will also return null if the specified down focusable view is not on a window.<br />
574 /// <since_tizen> 3 </since_tizen>
575 public View DownFocusableView
577 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
580 return (View)GetValue(DownFocusableViewProperty);
584 SetValue(DownFocusableViewProperty, value);
585 NotifyPropertyChanged();
590 /// Whether the view should be focusable by keyboard navigation.
592 /// <since_tizen> 3 </since_tizen>
593 public bool Focusable
597 SetValue(FocusableProperty, value);
598 NotifyPropertyChanged();
602 return (bool)GetValue(FocusableProperty);
607 /// Retrieves the position of the view.<br />
608 /// The coordinates are relative to the view's parent.<br />
610 /// <since_tizen> 3 </since_tizen>
611 public Position CurrentPosition
615 return GetCurrentPosition();
620 /// Sets the size of a view for the width and the height.<br />
621 /// Geometry can be scaled to fit within this area.<br />
622 /// This does not interfere with the view's scale factor.<br />
623 /// The views default depth is the minimum of width and height.<br />
626 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
627 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
629 /// <since_tizen> 3 </since_tizen>
634 Size2D temp = (Size2D)GetValue(Size2DProperty);
635 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
639 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
640 SetValue(Size2DProperty, value);
641 // Set Specification so when layouts measure this View it matches the value set here.
642 // All Views are currently Layouts.
643 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
644 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
645 _widthPolicy = value.Width;
646 _heightPolicy = value.Height;
647 _layout?.RequestLayout();
648 NotifyPropertyChanged();
653 /// Retrieves the size of the view.<br />
654 /// The coordinates are relative to the view's parent.<br />
656 /// <since_tizen> 3 </since_tizen>
657 public Size2D CurrentSize
661 return GetCurrentSize();
666 /// Retrieves and sets the view's opacity.<br />
668 /// <since_tizen> 3 </since_tizen>
673 return (float)GetValue(OpacityProperty);
677 SetValue(OpacityProperty, value);
678 NotifyPropertyChanged();
683 /// Sets the position of the view for X and Y.<br />
684 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
685 /// If the position inheritance is disabled, sets the world position.<br />
688 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
689 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
691 /// <since_tizen> 3 </since_tizen>
692 public Position2D Position2D
696 Position2D temp = (Position2D)GetValue(Position2DProperty);
697 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
701 SetValue(Position2DProperty, value);
702 NotifyPropertyChanged();
707 /// Retrieves the screen postion of the view.<br />
709 /// <since_tizen> 3 </since_tizen>
710 public Vector2 ScreenPosition
714 Vector2 temp = new Vector2(0.0f, 0.0f);
715 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
721 /// Determines whether the pivot point should be used to determine the position of the view.
722 /// This is true by default.
724 /// <remarks>If false, then the top-left of the view is used for the position.
725 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
727 /// <since_tizen> 3 </since_tizen>
728 public bool PositionUsesPivotPoint
732 return (bool)GetValue(PositionUsesPivotPointProperty);
736 SetValue(PositionUsesPivotPointProperty, value);
737 NotifyPropertyChanged();
742 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
744 /// <since_tizen> 3 </since_tizen>
745 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
747 "View view = new View(); " +
748 "view.PivotPoint = PivotPoint.Center; " +
749 "view.PositionUsesPivotPoint = true;" +
750 " Deprecated in API5: Will be removed in API8")]
751 [EditorBrowsable(EditorBrowsableState.Never)]
752 public bool PositionUsesAnchorPoint
757 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
762 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
763 NotifyPropertyChanged();
768 /// Queries whether the view is connected to the stage.<br />
769 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
771 /// <since_tizen> 3 </since_tizen>
772 public bool IsOnWindow
781 /// Gets the depth in the hierarchy for the view.
783 /// <since_tizen> 3 </since_tizen>
784 public int HierarchyDepth
788 return GetHierarchyDepth();
793 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
796 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
797 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
798 /// The values set by this property will likely change.
800 /// <since_tizen> 3 </since_tizen>
801 public int SiblingOrder
805 return (int)GetValue(SiblingOrderProperty);
809 SetValue(SiblingOrderProperty, value);
810 NotifyPropertyChanged();
815 /// Returns the natural size of the view.
818 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
820 /// <since_tizen> 5 </since_tizen>
821 public Vector3 NaturalSize
825 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
826 if (NDalicPINVOKE.SWIGPendingException.Pending)
827 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
833 /// Returns the natural size (Size2D) of the view.
836 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
838 /// <since_tizen> 4 </since_tizen>
839 public Size2D NaturalSize2D
843 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
844 if (NDalicPINVOKE.SWIGPendingException.Pending)
845 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
847 return new Size2D((int)temp.Width, (int)temp.Height);
852 /// Gets or sets the origin of a view within its parent's area.<br />
853 /// 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 />
854 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
855 /// A view's position is the distance between this origin and the view's anchor-point.<br />
857 /// <pre>The view has been initialized.</pre>
858 /// <since_tizen> 3 </since_tizen>
859 public Position ParentOrigin
863 Position tmp = (Position)GetValue(ParentOriginProperty);
864 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
868 SetValue(ParentOriginProperty, value);
869 NotifyPropertyChanged();
874 /// Gets or sets the anchor-point of a view.<br />
875 /// 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 />
876 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
877 /// A view position is the distance between its parent-origin and this anchor-point.<br />
878 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
879 /// <pre>The view has been initialized.</pre>
882 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
884 /// <since_tizen> 3 </since_tizen>
885 public Position PivotPoint
889 Position tmp = (Position)GetValue(PivotPointProperty);
890 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
894 SetValue(PivotPointProperty, value);
895 NotifyPropertyChanged();
900 /// Gets or sets the size width of the view.
904 /// Animatable - This property can be animated using <c>Animation</c> class.
907 /// <since_tizen> 3 </since_tizen>
908 public float SizeWidth
912 return (float)GetValue(SizeWidthProperty);
916 SetValue(SizeWidthProperty, value);
917 WidthSpecification = (int)Math.Ceiling(value);
918 NotifyPropertyChanged();
923 /// Gets or sets the size height of the view.
927 /// Animatable - This property can be animated using <c>Animation</c> class.
930 /// <since_tizen> 3 </since_tizen>
931 public float SizeHeight
935 return (float)GetValue(SizeHeightProperty);
939 SetValue(SizeHeightProperty, value);
940 HeightSpecification = (int)Math.Ceiling(value);
941 NotifyPropertyChanged();
946 /// Gets or sets the position of the view.<br />
947 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
948 /// If the position inheritance is disabled, sets the world position.<br />
952 /// Animatable - This property can be animated using <c>Animation</c> class.
954 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
956 /// <since_tizen> 3 </since_tizen>
957 public Position Position
961 Position tmp = (Position)GetValue(PositionProperty);
962 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
966 SetValue(PositionProperty, value);
967 NotifyPropertyChanged();
972 /// Gets or sets the position X of the view.
976 /// Animatable - This property can be animated using <c>Animation</c> class.
979 /// <since_tizen> 3 </since_tizen>
980 public float PositionX
984 return (float)GetValue(PositionXProperty);
988 SetValue(PositionXProperty, value);
989 NotifyPropertyChanged();
994 /// Gets or sets the position Y of the view.
998 /// Animatable - This property can be animated using <c>Animation</c> class.
1001 /// <since_tizen> 3 </since_tizen>
1002 public float PositionY
1006 return (float)GetValue(PositionYProperty);
1010 SetValue(PositionYProperty, value);
1011 NotifyPropertyChanged();
1016 /// Gets or sets the position Z of the view.
1020 /// Animatable - This property can be animated using <c>Animation</c> class.
1023 /// <since_tizen> 3 </since_tizen>
1024 public float PositionZ
1028 return (float)GetValue(PositionZProperty);
1032 SetValue(PositionZProperty, value);
1033 NotifyPropertyChanged();
1038 /// Gets or sets the world position of the view.
1040 /// <since_tizen> 3 </since_tizen>
1041 public Vector3 WorldPosition
1045 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1046 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1052 /// Gets or sets the orientation of the view.<br />
1053 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1057 /// This is an asynchronous method.
1060 /// Animatable - This property can be animated using <c>Animation</c> class.
1063 /// <since_tizen> 3 </since_tizen>
1064 public Rotation Orientation
1068 return (Rotation)GetValue(OrientationProperty);
1072 SetValue(OrientationProperty, value);
1073 NotifyPropertyChanged();
1078 /// Gets or sets the world orientation of the view.<br />
1080 /// <since_tizen> 3 </since_tizen>
1081 public Rotation WorldOrientation
1085 Rotation temp = new Rotation();
1086 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1092 /// Gets or sets the scale factor applied to the view.<br />
1096 /// Animatable - This property can be animated using <c>Animation</c> class.
1098 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1100 /// <since_tizen> 3 </since_tizen>
1101 public Vector3 Scale
1105 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1106 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1110 SetValue(ScaleProperty, value);
1111 NotifyPropertyChanged();
1116 /// Gets or sets the scale X factor applied to the view.
1120 /// Animatable - This property can be animated using <c>Animation</c> class.
1123 /// <since_tizen> 3 </since_tizen>
1128 return (float)GetValue(ScaleXProperty);
1132 SetValue(ScaleXProperty, value);
1133 NotifyPropertyChanged();
1138 /// Gets or sets the scale Y factor applied to the view.
1142 /// Animatable - This property can be animated using <c>Animation</c> class.
1145 /// <since_tizen> 3 </since_tizen>
1150 return (float)GetValue(ScaleYProperty);
1154 SetValue(ScaleYProperty, value);
1155 NotifyPropertyChanged();
1160 /// Gets or sets the scale Z factor applied to the view.
1164 /// Animatable - This property can be animated using <c>Animation</c> class.
1167 /// <since_tizen> 3 </since_tizen>
1172 return (float)GetValue(ScaleZProperty);
1176 SetValue(ScaleZProperty, value);
1177 NotifyPropertyChanged();
1182 /// Gets the world scale of the view.
1184 /// <since_tizen> 3 </since_tizen>
1185 public Vector3 WorldScale
1189 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1190 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1196 /// Retrieves the visibility flag of the view.
1200 /// If the view is not visible, then the view and its children will not be rendered.
1201 /// 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.
1204 /// Animatable - This property can be animated using <c>Animation</c> class.
1207 /// <since_tizen> 3 </since_tizen>
1208 public bool Visibility
1213 GetProperty(View.Property.VISIBLE).Get(out temp);
1219 /// Gets the view's world color.
1221 /// <since_tizen> 3 </since_tizen>
1222 public Vector4 WorldColor
1226 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1227 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1233 /// Gets or sets the view's name.
1235 /// <since_tizen> 3 </since_tizen>
1240 return (string)GetValue(NameProperty);
1244 SetValue(NameProperty, value);
1245 NotifyPropertyChanged();
1250 /// Get the number of children held by the view.
1252 /// <since_tizen> 3 </since_tizen>
1253 public new uint ChildCount
1257 return GetChildCount();
1262 /// Gets the view's ID.
1265 /// <since_tizen> 3 </since_tizen>
1275 /// Gets or sets the status of whether the view should emit touch or hover signals.
1277 /// <since_tizen> 3 </since_tizen>
1278 public bool Sensitive
1282 return (bool)GetValue(SensitiveProperty);
1286 SetValue(SensitiveProperty, value);
1287 NotifyPropertyChanged();
1292 /// 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.
1294 /// <since_tizen> 3 </since_tizen>
1295 public bool LeaveRequired
1299 return (bool)GetValue(LeaveRequiredProperty);
1303 SetValue(LeaveRequiredProperty, value);
1304 NotifyPropertyChanged();
1309 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1311 /// <since_tizen> 3 </since_tizen>
1312 public bool InheritOrientation
1316 return (bool)GetValue(InheritOrientationProperty);
1320 SetValue(InheritOrientationProperty, value);
1321 NotifyPropertyChanged();
1326 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1328 /// <since_tizen> 3 </since_tizen>
1329 public bool InheritScale
1333 return (bool)GetValue(InheritScaleProperty);
1337 SetValue(InheritScaleProperty, value);
1338 NotifyPropertyChanged();
1343 /// Gets or sets the status of how the view and its children should be drawn.<br />
1344 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1345 /// 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 />
1346 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1347 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1348 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1350 /// <since_tizen> 3 </since_tizen>
1351 public DrawModeType DrawMode
1355 return (DrawModeType)GetValue(DrawModeProperty);
1359 SetValue(DrawModeProperty, value);
1360 NotifyPropertyChanged();
1365 /// Gets or sets the relative to parent size factor of the view.<br />
1366 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1367 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1370 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1372 /// <since_tizen> 3 </since_tizen>
1373 public Vector3 SizeModeFactor
1377 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1378 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1382 SetValue(SizeModeFactorProperty, value);
1383 NotifyPropertyChanged();
1388 /// Gets or sets the width resize policy to be used.
1390 /// <since_tizen> 3 </since_tizen>
1391 public ResizePolicyType WidthResizePolicy
1395 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1399 SetValue(WidthResizePolicyProperty, value);
1400 // Match ResizePolicy to new Layouting.
1401 // Parent relative policies can not be mapped at this point as parent size unknown.
1404 case ResizePolicyType.UseNaturalSize:
1406 WidthSpecification = LayoutParamPolicies.WrapContent;
1409 case ResizePolicyType.FillToParent:
1411 WidthSpecification = LayoutParamPolicies.MatchParent;
1414 case ResizePolicyType.FitToChildren:
1416 WidthSpecification = LayoutParamPolicies.WrapContent;
1422 NotifyPropertyChanged();
1427 /// Gets or sets the height resize policy to be used.
1429 /// <since_tizen> 3 </since_tizen>
1430 public ResizePolicyType HeightResizePolicy
1434 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1438 SetValue(HeightResizePolicyProperty, value);
1439 // Match ResizePolicy to new Layouting.
1440 // Parent relative policies can not be mapped at this point as parent size unknown.
1443 case ResizePolicyType.UseNaturalSize:
1445 HeightSpecification = LayoutParamPolicies.WrapContent;
1448 case ResizePolicyType.FillToParent:
1450 HeightSpecification = LayoutParamPolicies.MatchParent;
1453 case ResizePolicyType.FitToChildren:
1455 HeightSpecification = LayoutParamPolicies.WrapContent;
1461 NotifyPropertyChanged();
1466 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1467 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1469 /// <since_tizen> 3 </since_tizen>
1470 public SizeScalePolicyType SizeScalePolicy
1474 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1478 SetValue(SizeScalePolicyProperty, value);
1479 NotifyPropertyChanged();
1484 /// Gets or sets the status of whether the width size is dependent on the height size.
1486 /// <since_tizen> 3 </since_tizen>
1487 public bool WidthForHeight
1491 return (bool)GetValue(WidthForHeightProperty);
1495 SetValue(WidthForHeightProperty, value);
1496 NotifyPropertyChanged();
1501 /// Gets or sets the status of whether the height size is dependent on the width size.
1503 /// <since_tizen> 3 </since_tizen>
1504 public bool HeightForWidth
1508 return (bool)GetValue(HeightForWidthProperty);
1512 SetValue(HeightForWidthProperty, value);
1513 NotifyPropertyChanged();
1518 /// Gets or sets the padding for use in layout.
1521 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1523 /// <since_tizen> 5 </since_tizen>
1524 public Extents Padding
1528 // If View has a Layout then padding in stored in the base Layout class
1531 return Layout.Padding;
1535 Extents temp = (Extents)GetValue(PaddingProperty);
1536 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1538 // Two return points to prevent creating a zeroed Extent native object before assignment
1542 Extents padding = value;
1545 // Layout set so store Padding in LayoutItem instead of in View.
1546 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1547 // the position and sizes measure in the Layouting.
1548 Layout.Padding = value;
1549 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1550 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1551 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1553 padding = new Extents(0,0,0,0); // Reset value stored in View.
1555 _layout?.RequestLayout();
1557 SetValue(PaddingProperty, padding);
1558 NotifyPropertyChanged();
1559 _layout?.RequestLayout();
1564 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1567 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1569 /// <since_tizen> 3 </since_tizen>
1570 public Size2D MinimumSize
1574 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1575 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1579 if (_layout != null)
1581 // Note: it only works if minimum size is >= than natural size.
1582 // To force the size it should be done through the width&height spec or Size2D.
1583 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1584 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1585 _layout.RequestLayout();
1587 SetValue(MinimumSizeProperty, value);
1588 NotifyPropertyChanged();
1593 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1596 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1598 /// <since_tizen> 3 </since_tizen>
1599 public Size2D MaximumSize
1603 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1604 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1608 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1609 // MATCH_PARENT spec + parent container size can be used to limit
1610 if (_layout != null)
1612 // Note: it only works if minimum size is >= than natural size.
1613 // To force the size it should be done through the width&height spec or Size2D.
1614 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1615 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1616 _layout.RequestLayout();
1618 SetValue(MaximumSizeProperty, value);
1619 NotifyPropertyChanged();
1624 /// Gets or sets whether a child view inherits it's parent's position.<br />
1625 /// Default is to inherit.<br />
1626 /// 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 />
1628 /// <since_tizen> 3 </since_tizen>
1629 public bool InheritPosition
1633 return (bool)GetValue(InheritPositionProperty);
1637 SetValue(InheritPositionProperty, value);
1638 NotifyPropertyChanged();
1643 /// Gets or sets the clipping behavior (mode) of it's children.
1645 /// <since_tizen> 3 </since_tizen>
1646 public ClippingModeType ClippingMode
1650 return (ClippingModeType)GetValue(ClippingModeProperty);
1654 SetValue(ClippingModeProperty, value);
1655 NotifyPropertyChanged();
1660 /// Gets the number of renderers held by the view.
1662 /// <since_tizen> 3 </since_tizen>
1663 public uint RendererCount
1667 return GetRendererCount();
1672 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1675 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1677 /// <since_tizen> 3 </since_tizen>
1678 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1680 "View view = new View(); " +
1681 "view.PivotPoint = PivotPoint.Center; " +
1682 "view.PositionUsesPivotPoint = true;")]
1683 [EditorBrowsable(EditorBrowsableState.Never)]
1684 public Position AnchorPoint
1688 Position temp = new Position(0.0f, 0.0f, 0.0f);
1689 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1690 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1694 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1695 NotifyPropertyChanged();
1700 /// Sets the size of a view for the width, the height and the depth.<br />
1701 /// Geometry can be scaled to fit within this area.<br />
1702 /// This does not interfere with the view's scale factor.<br />
1703 /// The views default depth is the minimum of width and height.<br />
1707 /// Animatable - This property can be animated using <c>Animation</c> class.
1709 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1711 /// <since_tizen> 5 </since_tizen>
1716 Size tmp = (Size)GetValue(SizeProperty);
1717 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1721 SetValue(SizeProperty, value);
1722 // Set Specification so when layouts measure this View it matches the value set here.
1723 // All Views are currently Layouts.
1724 WidthSpecification = (int)Math.Ceiling(value.Width);
1725 HeightSpecification = (int)Math.Ceiling(value.Height);
1726 NotifyPropertyChanged();
1731 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1733 /// <since_tizen> 3 </since_tizen>
1734 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1736 "Container parent = view.GetParent(); " +
1737 "View view = parent as View;")]
1738 [EditorBrowsable(EditorBrowsableState.Never)]
1739 public new View Parent
1744 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1745 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1746 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1748 if (basehandle is Layer layer)
1750 ret = new View(Layer.getCPtr(layer).Handle, false);
1751 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1755 ret = basehandle as View;
1758 Interop.BaseHandle.delete_BaseHandle(CPtr);
1759 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1761 if (NDalicPINVOKE.SWIGPendingException.Pending)
1762 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1768 /// Gets/Sets whether inherit parent's the layout Direction.
1770 /// <since_tizen> 4 </since_tizen>
1771 public bool InheritLayoutDirection
1775 return (bool)GetValue(InheritLayoutDirectionProperty);
1779 SetValue(InheritLayoutDirectionProperty, value);
1780 NotifyPropertyChanged();
1785 /// Gets/Sets the layout Direction.
1787 /// <since_tizen> 4 </since_tizen>
1788 public ViewLayoutDirectionType LayoutDirection
1792 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1796 SetValue(LayoutDirectionProperty, value);
1797 NotifyPropertyChanged();
1798 _layout?.RequestLayout();
1803 /// Gets or sets the Margin for use in layout.
1806 /// Margin property is supported by Layout algorithms and containers.
1807 /// Please Set Layout if you want to use Margin property.
1808 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1810 /// <since_tizen> 4 </since_tizen>
1811 public Extents Margin
1815 // If View has a Layout then margin is stored in Layout.
1818 return Layout.Margin;
1822 // If Layout not set then return margin stored in View.
1823 Extents temp = (Extents)GetValue(MarginProperty);
1824 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1826 // Two return points to prevent creating a zeroed Extent native object before assignment
1832 // Layout set so store Margin in LayoutItem instead of View.
1833 // If View stores the Margin too then the Legacy Size Negotiation will
1834 // overwrite the position and size values measured in the Layouting.
1835 Layout.Margin = value;
1836 SetValue(MarginProperty, new Extents(0,0,0,0));
1837 _layout?.RequestLayout();
1841 SetValue(MarginProperty, value);
1843 NotifyPropertyChanged();
1844 _layout?.RequestLayout();
1849 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1851 /// <since_tizen> 6 </since_tizen>
1852 public int WidthSpecification
1856 return _widthPolicy;
1860 _widthPolicy = value;
1861 if (_widthPolicy >= 0)
1863 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1865 if(_heightPolicy>=0) // Policy an exact value
1867 Size2D.Width = _widthPolicy;
1871 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1872 // Size2D height will store the specification value (negative number) this will then be applied to the
1873 // HeightSpecification when the Size2D callback is invoked.
1874 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1877 _layout?.RequestLayout();
1882 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1884 /// <since_tizen> 6 </since_tizen>
1885 public int HeightSpecification
1889 return _heightPolicy;
1893 _heightPolicy = value;
1894 if (_heightPolicy >= 0)
1896 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1898 if(_widthPolicy>=0) // Policy an exact value
1900 Size2D.Height = _heightPolicy;
1904 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1905 // Size2D height will store the specification value (negative number) this will then be applied to the
1906 // HeightSpecification when the Size2D callback is invoked.
1907 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1911 _layout?.RequestLayout();
1916 /// Gets the List of transitions for this View.
1918 /// <since_tizen> 6 </since_tizen>
1919 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
1923 if (_layoutTransitions == null)
1925 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1927 return _layoutTransitions;
1932 /// Set a layout transitions for this View.
1935 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
1937 /// <since_tizen> 6 </since_tizen>
1938 public LayoutTransition LayoutTransition
1942 if (_layoutTransitions == null)
1944 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1946 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
1948 AttachTransitionsToChildren(value);
1953 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
1956 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1958 /// <since_tizen> 4 </since_tizen>
1959 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
1960 [EditorBrowsable(EditorBrowsableState.Never)]
1961 public Extents PaddingEX
1965 Extents temp = new Extents(0, 0, 0, 0);
1966 GetProperty(View.Property.PADDING).Get(temp);
1967 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1971 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
1972 NotifyPropertyChanged();
1973 _layout?.RequestLayout();
1977 /// <since_tizen> 6 </since_tizen>
1978 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1979 [EditorBrowsable(EditorBrowsableState.Never)]
1980 public Style XamlStyle
1984 return (Style)GetValue(XamlStyleProperty);
1988 SetValue(XamlStyleProperty, value);
1993 /// The Color of View. This is an RGBA value.
1997 /// Animatable - This property can be animated using <c>Animation</c> class.
1999 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2001 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2002 [EditorBrowsable(EditorBrowsableState.Never)]
2007 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
2008 GetProperty(Interop.ActorProperty.Actor_Property_COLOR_get()).Get(temp);
2009 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2018 /// Set the layout on this View. Replaces any existing Layout.
2020 /// <since_tizen> 6 </since_tizen>
2021 public LayoutItem Layout
2029 // Do nothing if layout provided is already set on this View.
2030 if (value == _layout)
2035 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2036 layoutingDisabled = false;
2039 // If new layout being set already has a owner then that owner receives a replacement default layout.
2040 // First check if the layout to be set already has a owner.
2041 if (value?.Owner != null)
2043 // Previous owner of the layout gets a default layout as a replacement.
2044 value.Owner.Layout = new LayoutGroup();
2046 // Copy Margin and Padding to replacement LayoutGroup.
2047 value.Owner.Layout.Margin = value.Margin;
2048 value.Owner.Layout.Padding = value.Padding;
2051 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2052 // View if no replacement. Previously margin and padding values would have been moved from
2053 // the View to the layout.
2054 if (_layout != null ) // Existing layout
2058 // Existing layout being replaced so copy over margin and padding values.
2059 value.Margin = _layout.Margin;
2060 value.Padding = _layout.Padding;
2064 // Layout not being replaced so restore margin and padding to View.
2065 SetValue(MarginProperty, _layout.Margin);
2066 SetValue(PaddingProperty, _layout.Padding);
2067 NotifyPropertyChanged();
2072 // First Layout to be added to the View hence copy
2074 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2077 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2079 // If View already has a margin set then store it in Layout instead.
2080 value.Margin = Margin;
2081 SetValue(MarginProperty, new Extents(0,0,0,0));
2082 NotifyPropertyChanged();
2085 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2087 // If View already has a padding set then store it in Layout instead.
2088 value.Padding = Padding;
2089 SetValue(PaddingProperty, new Extents(0,0,0,0));
2090 NotifyPropertyChanged();
2095 // Remove existing layout from it's parent layout group.
2096 _layout?.Unparent();
2098 // Set layout to this view
2104 /// The weight of the View, used to share available space in a layout with siblings.
2106 /// <since_tizen> 6 </since_tizen>
2116 _layout?.RequestLayout();
2121 /// Whether to load the BackgroundImage synchronously.
2122 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2123 /// Note: For Normal Quad images only.
2125 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2126 [EditorBrowsable(EditorBrowsableState.Never)]
2127 public bool BackgroundImageSynchronosLoading
2131 return _backgroundImageSynchronosLoading;
2135 _backgroundImageSynchronosLoading = value;
2138 Background.Find(Visual.Property.Type)?.Get(out visualType);
2139 if (visualType == (int)Visual.Type.Image)
2141 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2144 if (bgUrl.Length != 0)
2146 PropertyMap bgMap = this.Background;
2147 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2153 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2154 [EditorBrowsable(EditorBrowsableState.Never)]
2155 public Vector2 UpdateSizeHint
2159 return (Vector2)GetValue(UpdateSizeHintProperty);
2163 SetValue(UpdateSizeHintProperty, value);
2164 NotifyPropertyChanged();
2168 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2169 [EditorBrowsable(EditorBrowsableState.Never)]
2170 public string[] TransitionNames
2174 return transitionNames;
2178 transitionNames = value;
2184 /// Get Style, it is abstract function and must be override.
2186 /// <since_tizen> 6 </since_tizen>
2187 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2188 [EditorBrowsable(EditorBrowsableState.Never)]
2189 protected virtual ViewStyle GetViewStyle()
2191 viewStyle = new ViewStyle();
2195 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2196 [EditorBrowsable(EditorBrowsableState.Never)]
2197 protected virtual bool OnControlStateChanged(ControlStates currentState)
2199 //If need to apply the state to all child, return true;
2202 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2204 var view = (View)bindable;
2205 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2207 defaultValueCreator: (bindable) =>
2209 var view = (View)bindable;
2210 return view.backgroundImageSelector;
2212 private TriggerableSelector<string> _backgroundImageSelector;
2213 private TriggerableSelector<string> backgroundImageSelector
2217 if (null == _backgroundImageSelector)
2219 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2221 return _backgroundImageSelector;
2224 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2226 var view = (View)bindable;
2227 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2229 defaultValueCreator: (bindable) =>
2231 var view = (View)bindable;
2232 return view.backgroundColorSelector;
2234 private TriggerableSelector<Color> _backgroundColorSelector;
2235 private TriggerableSelector<Color> backgroundColorSelector
2239 if (null == _backgroundColorSelector)
2241 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2243 return _backgroundColorSelector;
2246 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2248 var view = (View)bindable;
2249 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2251 defaultValueCreator: (bindable) =>
2253 var view = (View)bindable;
2254 return view.backgroundImageBorderSelector;
2256 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2257 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2261 if (null == _backgroundImageBorderSelector)
2263 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2265 return _backgroundImageBorderSelector;
2268 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2270 var view = (View)bindable;
2271 view.opacitySelector.Clone((Selector<float?>)newValue);
2273 defaultValueCreator: (bindable) =>
2275 var view = (View)bindable;
2276 return view.opacitySelector;
2278 private TriggerableSelector<float?> _opacitySelector;
2279 private TriggerableSelector<float?> opacitySelector
2283 if (null == _opacitySelector)
2285 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2287 return _opacitySelector;
2291 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2292 [EditorBrowsable(EditorBrowsableState.Never)]
2293 public virtual void ApplyStyle(ViewStyle viewStyle)
2295 if (null == viewStyle)
2300 if (this.viewStyle == viewStyle)
2305 if (null != this.viewStyle)
2307 simpleBinding.Clear();
2310 this.viewStyle = viewStyle;
2312 Dictionary<string, BindableProperty> bindablePropertyOfView;
2313 Type viewType = GetType();
2315 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2316 Type styleType = viewStyle.GetType();
2318 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2319 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2321 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2323 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2325 BindableProperty viewProperty;
2326 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2328 if (null != viewProperty)
2330 object value = viewStyle.GetValue(keyValuePair.Value);
2334 SetValue(viewProperty, value);
2337 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2343 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2344 [EditorBrowsable(EditorBrowsableState.Never)]
2345 private BundledPipe simpleBinding = new BundledPipe();