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;
61 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
63 private ViewStyle viewStyle;
64 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
65 [EditorBrowsable(EditorBrowsableState.Never)]
66 public ViewStyle ViewStyle
70 if (null == viewStyle)
72 ApplyStyle(GetViewStyle());
80 /// Creates a new instance of a view.
82 /// <since_tizen> 3 </since_tizen>
83 public View() : this(Interop.View.View_New(), true)
85 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
89 [EditorBrowsable(EditorBrowsableState.Never)]
90 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
92 this.ViewStyle.CopyFrom(viewStyle);
96 /// Create a new instance of a View with setting the status of shown or hidden.
98 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
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(bool shown) : this(Interop.View.View_New(), true)
103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
109 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
118 this.ViewStyle.CopyFrom(viewStyle);
121 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
125 PositionUsesPivotPoint = false;
128 _onWindowSendEventCallback = SendViewAddedEventToWindow;
129 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
137 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
139 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147 internal delegate void ControlStateChangesDelegate(View obj, ControlStates state);
148 internal event ControlStateChangesDelegate ControlStateChangeEvent;
150 private ControlStates controlStates;
152 /// Get/Set the control state.
154 /// <since_tizen> 6 </since_tizen>
155 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
156 [EditorBrowsable(EditorBrowsableState.Never)]
157 public ControlStates ControlState
161 return controlStates;
165 if (controlStates != value)
167 controlStates = value;
169 ControlStateChangeEvent?.Invoke(this, value);
171 foreach (View child in Children)
173 child.ControlState = value;
179 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
180 [EditorBrowsable(EditorBrowsableState.Never)]
181 public bool IsResourcesCreated
185 return Application.Current.IsResourcesCreated;
189 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
190 [EditorBrowsable(EditorBrowsableState.Never)]
191 public ResourceDictionary XamlResources
195 return Application.Current.XamlResources;
199 Application.Current.XamlResources = value;
204 /// The StyleName, type string.
206 /// <since_tizen> 3 </since_tizen>
207 public string StyleName
211 return (string)GetValue(StyleNameProperty);
215 SetValue(StyleNameProperty, value);
216 NotifyPropertyChanged();
221 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
224 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
226 /// <since_tizen> 3 </since_tizen>
227 public Color BackgroundColor
231 Color temp = (Color)GetValue(BackgroundColorProperty);
232 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
236 SetValue(BackgroundColorProperty, value);
237 NotifyPropertyChanged();
242 /// The mutually exclusive with "backgroundColor" and "background" type Map.
244 /// <since_tizen> 3 </since_tizen>
245 public string BackgroundImage
249 return (string)GetValue(BackgroundImageProperty);
253 SetValue(BackgroundImageProperty, value);
254 NotifyPropertyChanged();
259 /// The background of view.
261 /// <since_tizen> 3 </since_tizen>
262 public Tizen.NUI.PropertyMap Background
266 return (PropertyMap)GetValue(BackgroundProperty);
270 SetValue(BackgroundProperty, value);
271 NotifyPropertyChanged();
276 /// The current state of the view.
278 /// <since_tizen> 3 </since_tizen>
283 return (States)GetValue(StateProperty);
287 SetValue(StateProperty, value);
288 NotifyPropertyChanged();
293 /// The current sub state of the view.
295 /// <since_tizen> 3 </since_tizen>
296 public States SubState
300 return (States)GetValue(SubStateProperty);
304 SetValue(SubStateProperty, value);
305 NotifyPropertyChanged();
310 /// Displays a tooltip
312 /// <since_tizen> 3 </since_tizen>
313 public Tizen.NUI.PropertyMap Tooltip
317 return (PropertyMap)GetValue(TooltipProperty);
321 SetValue(TooltipProperty, value);
322 NotifyPropertyChanged();
327 /// Displays a tooltip as a text.
329 /// <since_tizen> 3 </since_tizen>
330 public string TooltipText
334 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
335 NotifyPropertyChanged();
340 /// The Child property of FlexContainer.<br />
341 /// The proportion of the free space in the container, the flex item will receive.<br />
342 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
344 /// <since_tizen> 3 </since_tizen>
349 return (float)GetValue(FlexProperty);
353 SetValue(FlexProperty, value);
354 NotifyPropertyChanged();
359 /// The Child property of FlexContainer.<br />
360 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
362 /// <since_tizen> 3 </since_tizen>
367 return (int)GetValue(AlignSelfProperty);
371 SetValue(AlignSelfProperty, value);
372 NotifyPropertyChanged();
377 /// The Child property of FlexContainer.<br />
378 /// The space around the flex item.<br />
381 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
383 /// <since_tizen> 3 </since_tizen>
384 public Vector4 FlexMargin
388 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
389 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
393 SetValue(FlexMarginProperty, value);
394 NotifyPropertyChanged();
399 /// The top-left cell this child occupies, if not set, the first available cell is used.
402 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
404 /// <since_tizen> 3 </since_tizen>
405 public Vector2 CellIndex
409 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
410 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
414 SetValue(CellIndexProperty, value);
415 NotifyPropertyChanged();
420 /// The number of rows this child occupies, if not set, the default value is 1.
422 /// <since_tizen> 3 </since_tizen>
427 return (float)GetValue(RowSpanProperty);
431 SetValue(RowSpanProperty, value);
432 NotifyPropertyChanged();
437 /// The number of columns this child occupies, if not set, the default value is 1.
439 /// <since_tizen> 3 </since_tizen>
440 public float ColumnSpan
444 return (float)GetValue(ColumnSpanProperty);
448 SetValue(ColumnSpanProperty, value);
449 NotifyPropertyChanged();
454 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
456 /// <since_tizen> 3 </since_tizen>
457 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
461 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
465 SetValue(CellHorizontalAlignmentProperty, value);
466 NotifyPropertyChanged();
471 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
473 /// <since_tizen> 3 </since_tizen>
474 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
478 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
482 SetValue(CellVerticalAlignmentProperty, value);
483 NotifyPropertyChanged();
488 /// The left focusable view.<br />
489 /// This will return null if not set.<br />
490 /// This will also return null if the specified left focusable view is not on a window.<br />
492 /// <since_tizen> 3 </since_tizen>
493 public View LeftFocusableView
495 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
498 return (View)GetValue(LeftFocusableViewProperty);
502 SetValue(LeftFocusableViewProperty, value);
503 NotifyPropertyChanged();
508 /// The right focusable view.<br />
509 /// This will return null if not set.<br />
510 /// This will also return null if the specified right focusable view is not on a window.<br />
512 /// <since_tizen> 3 </since_tizen>
513 public View RightFocusableView
515 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
518 return (View)GetValue(RightFocusableViewProperty);
522 SetValue(RightFocusableViewProperty, value);
523 NotifyPropertyChanged();
528 /// The up focusable view.<br />
529 /// This will return null if not set.<br />
530 /// This will also return null if the specified up focusable view is not on a window.<br />
532 /// <since_tizen> 3 </since_tizen>
533 public View UpFocusableView
535 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
538 return (View)GetValue(UpFocusableViewProperty);
542 SetValue(UpFocusableViewProperty, value);
543 NotifyPropertyChanged();
548 /// The down focusable view.<br />
549 /// This will return null if not set.<br />
550 /// This will also return null if the specified down focusable view is not on a window.<br />
552 /// <since_tizen> 3 </since_tizen>
553 public View DownFocusableView
555 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
558 return (View)GetValue(DownFocusableViewProperty);
562 SetValue(DownFocusableViewProperty, value);
563 NotifyPropertyChanged();
568 /// Whether the view should be focusable by keyboard navigation.
570 /// <since_tizen> 3 </since_tizen>
571 public bool Focusable
575 SetValue(FocusableProperty, value);
576 NotifyPropertyChanged();
580 return (bool)GetValue(FocusableProperty);
585 /// Retrieves the position of the view.<br />
586 /// The coordinates are relative to the view's parent.<br />
588 /// <since_tizen> 3 </since_tizen>
589 public Position CurrentPosition
593 return GetCurrentPosition();
598 /// Sets the size of a view for the width and the height.<br />
599 /// Geometry can be scaled to fit within this area.<br />
600 /// This does not interfere with the view's scale factor.<br />
601 /// The views default depth is the minimum of width and height.<br />
604 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
605 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
607 /// <since_tizen> 3 </since_tizen>
612 Size2D temp = (Size2D)GetValue(Size2DProperty);
613 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
617 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
618 SetValue(Size2DProperty, value);
619 // Set Specification so when layouts measure this View it matches the value set here.
620 // All Views are currently Layouts.
621 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
622 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
623 _widthPolicy = value.Width;
624 _heightPolicy = value.Height;
625 _layout?.RequestLayout();
626 NotifyPropertyChanged();
631 /// Retrieves the size of the view.<br />
632 /// The coordinates are relative to the view's parent.<br />
634 /// <since_tizen> 3 </since_tizen>
635 public Size2D CurrentSize
639 return GetCurrentSize();
644 /// Retrieves and sets the view's opacity.<br />
648 /// Animatable - This property can be animated using <c>Animation</c> class.
651 /// <since_tizen> 3 </since_tizen>
656 return (float)GetValue(OpacityProperty);
660 SetValue(OpacityProperty, value);
661 NotifyPropertyChanged();
666 /// Sets the position of the view for X and Y.<br />
667 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
668 /// If the position inheritance is disabled, sets the world position.<br />
671 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
672 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
674 /// <since_tizen> 3 </since_tizen>
675 public Position2D Position2D
679 Position2D temp = (Position2D)GetValue(Position2DProperty);
680 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
684 SetValue(Position2DProperty, value);
685 NotifyPropertyChanged();
690 /// Retrieves the screen postion of the view.<br />
692 /// <since_tizen> 3 </since_tizen>
693 public Vector2 ScreenPosition
697 Vector2 temp = new Vector2(0.0f, 0.0f);
698 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
704 /// Determines whether the pivot point should be used to determine the position of the view.
705 /// This is true by default.
707 /// <remarks>If false, then the top-left of the view is used for the position.
708 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
710 /// <since_tizen> 3 </since_tizen>
711 public bool PositionUsesPivotPoint
715 return (bool)GetValue(PositionUsesPivotPointProperty);
719 SetValue(PositionUsesPivotPointProperty, value);
720 NotifyPropertyChanged();
725 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
727 /// <since_tizen> 3 </since_tizen>
728 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
730 "View view = new View(); " +
731 "view.PivotPoint = PivotPoint.Center; " +
732 "view.PositionUsesPivotPoint = true;" +
733 " Deprecated in API5: Will be removed in API8")]
734 [EditorBrowsable(EditorBrowsableState.Never)]
735 public bool PositionUsesAnchorPoint
740 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
745 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
746 NotifyPropertyChanged();
751 /// Queries whether the view is connected to the stage.<br />
752 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
754 /// <since_tizen> 3 </since_tizen>
755 public bool IsOnWindow
764 /// Gets the depth in the hierarchy for the view.
766 /// <since_tizen> 3 </since_tizen>
767 public int HierarchyDepth
771 return GetHierarchyDepth();
776 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
779 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
780 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
781 /// The values set by this property will likely change.
783 /// <since_tizen> 3 </since_tizen>
784 public int SiblingOrder
788 return (int)GetValue(SiblingOrderProperty);
792 SetValue(SiblingOrderProperty, value);
793 NotifyPropertyChanged();
798 /// Returns the natural size of the view.
801 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
803 /// <since_tizen> 5 </since_tizen>
804 public Vector3 NaturalSize
808 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
809 if (NDalicPINVOKE.SWIGPendingException.Pending)
810 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
816 /// Returns the natural size (Size2D) of the view.
819 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
821 /// <since_tizen> 4 </since_tizen>
822 public Size2D NaturalSize2D
826 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
827 if (NDalicPINVOKE.SWIGPendingException.Pending)
828 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
830 return new Size2D((int)temp.Width, (int)temp.Height);
835 /// Gets or sets the origin of a view within its parent's area.<br />
836 /// 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 />
837 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
838 /// A view's position is the distance between this origin and the view's anchor-point.<br />
840 /// <pre>The view has been initialized.</pre>
841 /// <since_tizen> 3 </since_tizen>
842 public Position ParentOrigin
846 Position tmp = (Position)GetValue(ParentOriginProperty);
847 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
851 SetValue(ParentOriginProperty, value);
852 NotifyPropertyChanged();
857 /// Gets or sets the anchor-point of a view.<br />
858 /// 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 />
859 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
860 /// A view position is the distance between its parent-origin and this anchor-point.<br />
861 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
862 /// <pre>The view has been initialized.</pre>
865 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
867 /// <since_tizen> 3 </since_tizen>
868 public Position PivotPoint
872 Position tmp = (Position)GetValue(PivotPointProperty);
873 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
877 SetValue(PivotPointProperty, value);
878 NotifyPropertyChanged();
883 /// Gets or sets the size width of the view.
887 /// Animatable - This property can be animated using <c>Animation</c> class.
890 /// <since_tizen> 3 </since_tizen>
891 public float SizeWidth
895 return (float)GetValue(SizeWidthProperty);
899 SetValue(SizeWidthProperty, value);
900 WidthSpecification = (int)Math.Ceiling(value);
901 NotifyPropertyChanged();
906 /// Gets or sets the size height of the view.
910 /// Animatable - This property can be animated using <c>Animation</c> class.
913 /// <since_tizen> 3 </since_tizen>
914 public float SizeHeight
918 return (float)GetValue(SizeHeightProperty);
922 SetValue(SizeHeightProperty, value);
923 HeightSpecification = (int)Math.Ceiling(value);
924 NotifyPropertyChanged();
929 /// Gets or sets the position of the view.<br />
930 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
931 /// If the position inheritance is disabled, sets the world position.<br />
935 /// Animatable - This property can be animated using <c>Animation</c> class.
937 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
939 /// <since_tizen> 3 </since_tizen>
940 public Position Position
944 Position tmp = (Position)GetValue(PositionProperty);
945 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
949 SetValue(PositionProperty, value);
950 NotifyPropertyChanged();
955 /// Gets or sets the position X of the view.
959 /// Animatable - This property can be animated using <c>Animation</c> class.
962 /// <since_tizen> 3 </since_tizen>
963 public float PositionX
967 return (float)GetValue(PositionXProperty);
971 SetValue(PositionXProperty, value);
972 NotifyPropertyChanged();
977 /// Gets or sets the position Y of the view.
981 /// Animatable - This property can be animated using <c>Animation</c> class.
984 /// <since_tizen> 3 </since_tizen>
985 public float PositionY
989 return (float)GetValue(PositionYProperty);
993 SetValue(PositionYProperty, value);
994 NotifyPropertyChanged();
999 /// Gets or sets the position Z of the view.
1003 /// Animatable - This property can be animated using <c>Animation</c> class.
1006 /// <since_tizen> 3 </since_tizen>
1007 public float PositionZ
1011 return (float)GetValue(PositionZProperty);
1015 SetValue(PositionZProperty, value);
1016 NotifyPropertyChanged();
1021 /// Gets or sets the world position of the view.
1023 /// <since_tizen> 3 </since_tizen>
1024 public Vector3 WorldPosition
1028 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1029 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1035 /// Gets or sets the orientation of the view.<br />
1036 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1040 /// This is an asynchronous method.
1043 /// Animatable - This property can be animated using <c>Animation</c> class.
1046 /// <since_tizen> 3 </since_tizen>
1047 public Rotation Orientation
1051 return (Rotation)GetValue(OrientationProperty);
1055 SetValue(OrientationProperty, value);
1056 NotifyPropertyChanged();
1061 /// Gets or sets the world orientation of the view.<br />
1063 /// <since_tizen> 3 </since_tizen>
1064 public Rotation WorldOrientation
1068 Rotation temp = new Rotation();
1069 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1075 /// Gets or sets the scale factor applied to the view.<br />
1079 /// Animatable - This property can be animated using <c>Animation</c> class.
1081 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1083 /// <since_tizen> 3 </since_tizen>
1084 public Vector3 Scale
1088 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1089 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1093 SetValue(ScaleProperty, value);
1094 NotifyPropertyChanged();
1099 /// Gets or sets the scale X factor applied to the view.
1103 /// Animatable - This property can be animated using <c>Animation</c> class.
1106 /// <since_tizen> 3 </since_tizen>
1111 return (float)GetValue(ScaleXProperty);
1115 SetValue(ScaleXProperty, value);
1116 NotifyPropertyChanged();
1121 /// Gets or sets the scale Y factor applied to the view.
1125 /// Animatable - This property can be animated using <c>Animation</c> class.
1128 /// <since_tizen> 3 </since_tizen>
1133 return (float)GetValue(ScaleYProperty);
1137 SetValue(ScaleYProperty, value);
1138 NotifyPropertyChanged();
1143 /// Gets or sets the scale Z factor applied to the view.
1147 /// Animatable - This property can be animated using <c>Animation</c> class.
1150 /// <since_tizen> 3 </since_tizen>
1155 return (float)GetValue(ScaleZProperty);
1159 SetValue(ScaleZProperty, value);
1160 NotifyPropertyChanged();
1165 /// Gets the world scale of the view.
1167 /// <since_tizen> 3 </since_tizen>
1168 public Vector3 WorldScale
1172 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1173 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1179 /// Retrieves the visibility flag of the view.
1183 /// If the view is not visible, then the view and its children will not be rendered.
1184 /// 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.
1187 /// <since_tizen> 3 </since_tizen>
1188 public bool Visibility
1193 GetProperty(View.Property.VISIBLE).Get(out temp);
1199 /// Gets the view's world color.
1201 /// <since_tizen> 3 </since_tizen>
1202 public Vector4 WorldColor
1206 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1207 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1213 /// Gets or sets the view's name.
1215 /// <since_tizen> 3 </since_tizen>
1220 return (string)GetValue(NameProperty);
1224 SetValue(NameProperty, value);
1225 NotifyPropertyChanged();
1230 /// Get the number of children held by the view.
1232 /// <since_tizen> 3 </since_tizen>
1233 public new uint ChildCount
1237 return GetChildCount();
1242 /// Gets the view's ID.
1245 /// <since_tizen> 3 </since_tizen>
1255 /// Gets or sets the status of whether the view should emit touch or hover signals.
1257 /// <since_tizen> 3 </since_tizen>
1258 public bool Sensitive
1262 return (bool)GetValue(SensitiveProperty);
1266 SetValue(SensitiveProperty, value);
1267 NotifyPropertyChanged();
1272 /// 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.
1274 /// <since_tizen> 3 </since_tizen>
1275 public bool LeaveRequired
1279 return (bool)GetValue(LeaveRequiredProperty);
1283 SetValue(LeaveRequiredProperty, value);
1284 NotifyPropertyChanged();
1289 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1291 /// <since_tizen> 3 </since_tizen>
1292 public bool InheritOrientation
1296 return (bool)GetValue(InheritOrientationProperty);
1300 SetValue(InheritOrientationProperty, value);
1301 NotifyPropertyChanged();
1306 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1308 /// <since_tizen> 3 </since_tizen>
1309 public bool InheritScale
1313 return (bool)GetValue(InheritScaleProperty);
1317 SetValue(InheritScaleProperty, value);
1318 NotifyPropertyChanged();
1323 /// Gets or sets the status of how the view and its children should be drawn.<br />
1324 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1325 /// 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 />
1326 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1327 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1328 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1330 /// <since_tizen> 3 </since_tizen>
1331 public DrawModeType DrawMode
1335 return (DrawModeType)GetValue(DrawModeProperty);
1339 SetValue(DrawModeProperty, value);
1340 NotifyPropertyChanged();
1345 /// Gets or sets the relative to parent size factor of the view.<br />
1346 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1347 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1350 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1352 /// <since_tizen> 3 </since_tizen>
1353 public Vector3 SizeModeFactor
1357 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1358 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1362 SetValue(SizeModeFactorProperty, value);
1363 NotifyPropertyChanged();
1368 /// Gets or sets the width resize policy to be used.
1370 /// <since_tizen> 3 </since_tizen>
1371 public ResizePolicyType WidthResizePolicy
1375 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1379 SetValue(WidthResizePolicyProperty, value);
1380 // Match ResizePolicy to new Layouting.
1381 // Parent relative policies can not be mapped at this point as parent size unknown.
1384 case ResizePolicyType.UseNaturalSize:
1386 WidthSpecification = LayoutParamPolicies.WrapContent;
1389 case ResizePolicyType.FillToParent:
1391 WidthSpecification = LayoutParamPolicies.MatchParent;
1394 case ResizePolicyType.FitToChildren:
1396 WidthSpecification = LayoutParamPolicies.WrapContent;
1402 NotifyPropertyChanged();
1407 /// Gets or sets the height resize policy to be used.
1409 /// <since_tizen> 3 </since_tizen>
1410 public ResizePolicyType HeightResizePolicy
1414 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1418 SetValue(HeightResizePolicyProperty, value);
1419 // Match ResizePolicy to new Layouting.
1420 // Parent relative policies can not be mapped at this point as parent size unknown.
1423 case ResizePolicyType.UseNaturalSize:
1425 HeightSpecification = LayoutParamPolicies.WrapContent;
1428 case ResizePolicyType.FillToParent:
1430 HeightSpecification = LayoutParamPolicies.MatchParent;
1433 case ResizePolicyType.FitToChildren:
1435 HeightSpecification = LayoutParamPolicies.WrapContent;
1441 NotifyPropertyChanged();
1446 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1447 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1449 /// <since_tizen> 3 </since_tizen>
1450 public SizeScalePolicyType SizeScalePolicy
1454 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1458 SetValue(SizeScalePolicyProperty, value);
1459 NotifyPropertyChanged();
1464 /// Gets or sets the status of whether the width size is dependent on the height size.
1466 /// <since_tizen> 3 </since_tizen>
1467 public bool WidthForHeight
1471 return (bool)GetValue(WidthForHeightProperty);
1475 SetValue(WidthForHeightProperty, value);
1476 NotifyPropertyChanged();
1481 /// Gets or sets the status of whether the height size is dependent on the width size.
1483 /// <since_tizen> 3 </since_tizen>
1484 public bool HeightForWidth
1488 return (bool)GetValue(HeightForWidthProperty);
1492 SetValue(HeightForWidthProperty, value);
1493 NotifyPropertyChanged();
1498 /// Gets or sets the padding for use in layout.
1501 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1503 /// <since_tizen> 5 </since_tizen>
1504 public Extents Padding
1508 // If View has a Layout then padding in stored in the base Layout class
1511 return Layout.Padding;
1515 Extents temp = (Extents)GetValue(PaddingProperty);
1516 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1518 // Two return points to prevent creating a zeroed Extent native object before assignment
1522 Extents padding = value;
1525 // Layout set so store Padding in LayoutItem instead of in View.
1526 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1527 // the position and sizes measure in the Layouting.
1528 Layout.Padding = value;
1529 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1530 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1531 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1533 padding = new Extents(0,0,0,0); // Reset value stored in View.
1535 _layout?.RequestLayout();
1537 SetValue(PaddingProperty, padding);
1538 NotifyPropertyChanged();
1539 _layout?.RequestLayout();
1544 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1547 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1549 /// <since_tizen> 3 </since_tizen>
1550 public Size2D MinimumSize
1554 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1555 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1559 if (_layout != null)
1561 // Note: it only works if minimum size is >= than natural size.
1562 // To force the size it should be done through the width&height spec or Size2D.
1563 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1564 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1565 _layout.RequestLayout();
1567 SetValue(MinimumSizeProperty, value);
1568 NotifyPropertyChanged();
1573 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1576 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1578 /// <since_tizen> 3 </since_tizen>
1579 public Size2D MaximumSize
1583 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1584 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1588 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1589 // MATCH_PARENT spec + parent container size can be used to limit
1590 if (_layout != null)
1592 // Note: it only works if minimum size is >= than natural size.
1593 // To force the size it should be done through the width&height spec or Size2D.
1594 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1595 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1596 _layout.RequestLayout();
1598 SetValue(MaximumSizeProperty, value);
1599 NotifyPropertyChanged();
1604 /// Gets or sets whether a child view inherits it's parent's position.<br />
1605 /// Default is to inherit.<br />
1606 /// 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 />
1608 /// <since_tizen> 3 </since_tizen>
1609 public bool InheritPosition
1613 return (bool)GetValue(InheritPositionProperty);
1617 SetValue(InheritPositionProperty, value);
1618 NotifyPropertyChanged();
1623 /// Gets or sets the clipping behavior (mode) of it's children.
1625 /// <since_tizen> 3 </since_tizen>
1626 public ClippingModeType ClippingMode
1630 return (ClippingModeType)GetValue(ClippingModeProperty);
1634 SetValue(ClippingModeProperty, value);
1635 NotifyPropertyChanged();
1640 /// Gets the number of renderers held by the view.
1642 /// <since_tizen> 3 </since_tizen>
1643 public uint RendererCount
1647 return GetRendererCount();
1652 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1655 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1657 /// <since_tizen> 3 </since_tizen>
1658 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1660 "View view = new View(); " +
1661 "view.PivotPoint = PivotPoint.Center; " +
1662 "view.PositionUsesPivotPoint = true;")]
1663 [EditorBrowsable(EditorBrowsableState.Never)]
1664 public Position AnchorPoint
1668 Position temp = new Position(0.0f, 0.0f, 0.0f);
1669 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1670 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1674 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1675 NotifyPropertyChanged();
1680 /// Sets the size of a view for the width, the height and the depth.<br />
1681 /// Geometry can be scaled to fit within this area.<br />
1682 /// This does not interfere with the view's scale factor.<br />
1683 /// The views default depth is the minimum of width and height.<br />
1687 /// Animatable - This property can be animated using <c>Animation</c> class.
1689 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1691 /// <since_tizen> 5 </since_tizen>
1696 Size tmp = (Size)GetValue(SizeProperty);
1697 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1701 SetValue(SizeProperty, value);
1702 // Set Specification so when layouts measure this View it matches the value set here.
1703 // All Views are currently Layouts.
1704 WidthSpecification = (int)Math.Ceiling(value.Width);
1705 HeightSpecification = (int)Math.Ceiling(value.Height);
1706 NotifyPropertyChanged();
1711 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1713 /// <since_tizen> 3 </since_tizen>
1714 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1716 "Container parent = view.GetParent(); " +
1717 "View view = parent as View;")]
1718 [EditorBrowsable(EditorBrowsableState.Never)]
1719 public new View Parent
1724 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1725 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1726 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1728 if (basehandle is Layer layer)
1730 ret = new View(Layer.getCPtr(layer).Handle, false);
1731 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1735 ret = basehandle as View;
1738 Interop.BaseHandle.delete_BaseHandle(CPtr);
1739 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1741 if (NDalicPINVOKE.SWIGPendingException.Pending)
1742 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1748 /// Gets/Sets whether inherit parent's the layout Direction.
1750 /// <since_tizen> 4 </since_tizen>
1751 public bool InheritLayoutDirection
1755 return (bool)GetValue(InheritLayoutDirectionProperty);
1759 SetValue(InheritLayoutDirectionProperty, value);
1760 NotifyPropertyChanged();
1765 /// Gets/Sets the layout Direction.
1767 /// <since_tizen> 4 </since_tizen>
1768 public ViewLayoutDirectionType LayoutDirection
1772 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1776 SetValue(LayoutDirectionProperty, value);
1777 NotifyPropertyChanged();
1778 _layout?.RequestLayout();
1783 /// Gets or sets the Margin for use in layout.
1786 /// Margin property is supported by Layout algorithms and containers.
1787 /// Please Set Layout if you want to use Margin property.
1788 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1790 /// <since_tizen> 4 </since_tizen>
1791 public Extents Margin
1795 // If View has a Layout then margin is stored in Layout.
1798 return Layout.Margin;
1802 // If Layout not set then return margin stored in View.
1803 Extents temp = (Extents)GetValue(MarginProperty);
1804 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1806 // Two return points to prevent creating a zeroed Extent native object before assignment
1812 // Layout set so store Margin in LayoutItem instead of View.
1813 // If View stores the Margin too then the Legacy Size Negotiation will
1814 // overwrite the position and size values measured in the Layouting.
1815 Layout.Margin = value;
1816 SetValue(MarginProperty, new Extents(0,0,0,0));
1817 _layout?.RequestLayout();
1821 SetValue(MarginProperty, value);
1823 NotifyPropertyChanged();
1824 _layout?.RequestLayout();
1829 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1831 /// <since_tizen> 6 </since_tizen>
1832 public int WidthSpecification
1836 return _widthPolicy;
1840 _widthPolicy = value;
1841 if (_widthPolicy >= 0)
1843 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1845 if(_heightPolicy>=0) // Policy an exact value
1847 Size2D.Width = _widthPolicy;
1851 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1852 // Size2D height will store the specification value (negative number) this will then be applied to the
1853 // HeightSpecification when the Size2D callback is invoked.
1854 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1857 _layout?.RequestLayout();
1862 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1864 /// <since_tizen> 6 </since_tizen>
1865 public int HeightSpecification
1869 return _heightPolicy;
1873 _heightPolicy = value;
1874 if (_heightPolicy >= 0)
1876 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1878 if(_widthPolicy>=0) // Policy an exact value
1880 Size2D.Height = _heightPolicy;
1884 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1885 // Size2D height will store the specification value (negative number) this will then be applied to the
1886 // HeightSpecification when the Size2D callback is invoked.
1887 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1891 _layout?.RequestLayout();
1896 /// Gets the List of transitions for this View.
1898 /// <since_tizen> 6 </since_tizen>
1899 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
1903 if (_layoutTransitions == null)
1905 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1907 return _layoutTransitions;
1912 /// Set a layout transitions for this View.
1915 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
1917 /// <since_tizen> 6 </since_tizen>
1918 public LayoutTransition LayoutTransition
1922 if (_layoutTransitions == null)
1924 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1926 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
1928 AttachTransitionsToChildren(value);
1933 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
1936 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1938 /// <since_tizen> 4 </since_tizen>
1939 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
1940 [EditorBrowsable(EditorBrowsableState.Never)]
1941 public Extents PaddingEX
1945 Extents temp = new Extents(0, 0, 0, 0);
1946 GetProperty(View.Property.PADDING).Get(temp);
1947 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1951 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
1952 NotifyPropertyChanged();
1953 _layout?.RequestLayout();
1957 /// <since_tizen> 6 </since_tizen>
1958 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1959 [EditorBrowsable(EditorBrowsableState.Never)]
1960 public Style XamlStyle
1964 return (Style)GetValue(XamlStyleProperty);
1968 SetValue(XamlStyleProperty, value);
1973 /// The Color of View. This is an RGBA value.
1977 /// Animatable - This property can be animated using <c>Animation</c> class.
1979 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
1981 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1982 [EditorBrowsable(EditorBrowsableState.Never)]
1987 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1988 GetProperty(Interop.ActorProperty.Actor_Property_COLOR_get()).Get(temp);
1989 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
1998 /// Set the layout on this View. Replaces any existing Layout.
2000 /// <since_tizen> 6 </since_tizen>
2001 public LayoutItem Layout
2009 // Do nothing if layout provided is already set on this View.
2010 if (value == _layout)
2015 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2016 layoutingDisabled = false;
2019 // If new layout being set already has a owner then that owner receives a replacement default layout.
2020 // First check if the layout to be set already has a owner.
2021 if (value?.Owner != null)
2023 // Previous owner of the layout gets a default layout as a replacement.
2024 value.Owner.Layout = new LayoutGroup();
2026 // Copy Margin and Padding to replacement LayoutGroup.
2027 value.Owner.Layout.Margin = value.Margin;
2028 value.Owner.Layout.Padding = value.Padding;
2031 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2032 // View if no replacement. Previously margin and padding values would have been moved from
2033 // the View to the layout.
2034 if (_layout != null ) // Existing layout
2038 // Existing layout being replaced so copy over margin and padding values.
2039 value.Margin = _layout.Margin;
2040 value.Padding = _layout.Padding;
2044 // Layout not being replaced so restore margin and padding to View.
2045 SetValue(MarginProperty, _layout.Margin);
2046 SetValue(PaddingProperty, _layout.Padding);
2047 NotifyPropertyChanged();
2052 // First Layout to be added to the View hence copy
2054 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2057 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2059 // If View already has a margin set then store it in Layout instead.
2060 value.Margin = Margin;
2061 SetValue(MarginProperty, new Extents(0,0,0,0));
2062 NotifyPropertyChanged();
2065 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2067 // If View already has a padding set then store it in Layout instead.
2068 value.Padding = Padding;
2069 SetValue(PaddingProperty, new Extents(0,0,0,0));
2070 NotifyPropertyChanged();
2075 // Remove existing layout from it's parent layout group.
2076 _layout?.Unparent();
2078 // Set layout to this view
2084 /// The weight of the View, used to share available space in a layout with siblings.
2086 /// <since_tizen> 6 </since_tizen>
2096 _layout?.RequestLayout();
2101 /// Whether to load the BackgroundImage synchronously.
2102 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2103 /// Note: For Normal Quad images only.
2105 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2106 [EditorBrowsable(EditorBrowsableState.Never)]
2107 public bool BackgroundImageSynchronosLoading
2111 return _backgroundImageSynchronosLoading;
2115 _backgroundImageSynchronosLoading = value;
2118 Background.Find(Visual.Property.Type)?.Get(out visualType);
2119 if (visualType == (int)Visual.Type.Image)
2121 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2124 if (bgUrl.Length != 0)
2126 PropertyMap bgMap = this.Background;
2127 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2133 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2134 [EditorBrowsable(EditorBrowsableState.Never)]
2135 public Vector2 UpdateSizeHint
2139 return (Vector2)GetValue(UpdateSizeHintProperty);
2143 SetValue(UpdateSizeHintProperty, value);
2144 NotifyPropertyChanged();
2148 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2149 [EditorBrowsable(EditorBrowsableState.Never)]
2150 public string[] TransitionNames
2154 return transitionNames;
2158 transitionNames = value;
2164 /// Get attribues, it is abstract function and must be override.
2166 /// <since_tizen> 6 </since_tizen>
2167 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2168 [EditorBrowsable(EditorBrowsableState.Never)]
2169 protected virtual ViewStyle GetViewStyle()
2171 viewStyle = new ViewStyle();
2175 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2177 var view = (View)bindable;
2178 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2180 defaultValueCreator: (bindable) =>
2182 var view = (View)bindable;
2183 return view.backgroundColorSelector;
2185 private TriggerableSelector<Color> _backgroundColorSelector;
2186 private TriggerableSelector<Color> backgroundColorSelector
2190 if (null == _backgroundColorSelector)
2192 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2194 return _backgroundColorSelector;
2198 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2200 var view = (View)bindable;
2201 view.opacitySelector.Clone((Selector<float?>)newValue);
2203 defaultValueCreator: (bindable) =>
2205 var view = (View)bindable;
2206 return view.opacitySelector;
2208 private TriggerableSelector<float?> _opacitySelector;
2209 private TriggerableSelector<float?> opacitySelector
2213 if (null == _opacitySelector)
2215 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2217 return _opacitySelector;
2221 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2222 [EditorBrowsable(EditorBrowsableState.Never)]
2223 public virtual void ApplyStyle(ViewStyle viewStyle)
2225 if (null == viewStyle)
2230 if (this.viewStyle == viewStyle)
2235 if (null != this.viewStyle)
2237 simpleBinding.Clear();
2240 this.viewStyle = viewStyle;
2242 Dictionary<string, BindableProperty> bindablePropertyOfView;
2243 Type viewType = GetType();
2245 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2246 Type styleType = viewStyle.GetType();
2248 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2249 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2251 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2253 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2255 BindableProperty viewProperty;
2256 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2258 if (null != viewProperty)
2260 object value = viewStyle.GetValue(keyValuePair.Value);
2264 SetValue(viewProperty, value);
2267 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2273 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2274 [EditorBrowsable(EditorBrowsableState.Never)]
2275 private BundledPipe simpleBinding = new BundledPipe();