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 />
646 /// <since_tizen> 3 </since_tizen>
651 return (float)GetValue(OpacityProperty);
655 SetValue(OpacityProperty, value);
656 NotifyPropertyChanged();
661 /// Sets the position of the view for X and Y.<br />
662 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
663 /// If the position inheritance is disabled, sets the world position.<br />
666 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
667 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
669 /// <since_tizen> 3 </since_tizen>
670 public Position2D Position2D
674 Position2D temp = (Position2D)GetValue(Position2DProperty);
675 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
679 SetValue(Position2DProperty, value);
680 NotifyPropertyChanged();
685 /// Retrieves the screen postion of the view.<br />
687 /// <since_tizen> 3 </since_tizen>
688 public Vector2 ScreenPosition
692 Vector2 temp = new Vector2(0.0f, 0.0f);
693 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
699 /// Determines whether the pivot point should be used to determine the position of the view.
700 /// This is true by default.
702 /// <remarks>If false, then the top-left of the view is used for the position.
703 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
705 /// <since_tizen> 3 </since_tizen>
706 public bool PositionUsesPivotPoint
710 return (bool)GetValue(PositionUsesPivotPointProperty);
714 SetValue(PositionUsesPivotPointProperty, value);
715 NotifyPropertyChanged();
720 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
722 /// <since_tizen> 3 </since_tizen>
723 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
725 "View view = new View(); " +
726 "view.PivotPoint = PivotPoint.Center; " +
727 "view.PositionUsesPivotPoint = true;" +
728 " Deprecated in API5: Will be removed in API8")]
729 [EditorBrowsable(EditorBrowsableState.Never)]
730 public bool PositionUsesAnchorPoint
735 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
740 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
741 NotifyPropertyChanged();
746 /// Queries whether the view is connected to the stage.<br />
747 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
749 /// <since_tizen> 3 </since_tizen>
750 public bool IsOnWindow
759 /// Gets the depth in the hierarchy for the view.
761 /// <since_tizen> 3 </since_tizen>
762 public int HierarchyDepth
766 return GetHierarchyDepth();
771 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
774 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
775 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
776 /// The values set by this property will likely change.
778 /// <since_tizen> 3 </since_tizen>
779 public int SiblingOrder
783 return (int)GetValue(SiblingOrderProperty);
787 SetValue(SiblingOrderProperty, value);
788 NotifyPropertyChanged();
793 /// Returns the natural size of the view.
796 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
798 /// <since_tizen> 5 </since_tizen>
799 public Vector3 NaturalSize
803 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
804 if (NDalicPINVOKE.SWIGPendingException.Pending)
805 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
811 /// Returns the natural size (Size2D) of the view.
814 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
816 /// <since_tizen> 4 </since_tizen>
817 public Size2D NaturalSize2D
821 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
822 if (NDalicPINVOKE.SWIGPendingException.Pending)
823 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
825 return new Size2D((int)temp.Width, (int)temp.Height);
830 /// Gets or sets the origin of a view within its parent's area.<br />
831 /// 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 />
832 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
833 /// A view's position is the distance between this origin and the view's anchor-point.<br />
835 /// <pre>The view has been initialized.</pre>
836 /// <since_tizen> 3 </since_tizen>
837 public Position ParentOrigin
841 Position tmp = (Position)GetValue(ParentOriginProperty);
842 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
846 SetValue(ParentOriginProperty, value);
847 NotifyPropertyChanged();
852 /// Gets or sets the anchor-point of a view.<br />
853 /// 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 />
854 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
855 /// A view position is the distance between its parent-origin and this anchor-point.<br />
856 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
857 /// <pre>The view has been initialized.</pre>
860 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
862 /// <since_tizen> 3 </since_tizen>
863 public Position PivotPoint
867 Position tmp = (Position)GetValue(PivotPointProperty);
868 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
872 SetValue(PivotPointProperty, value);
873 NotifyPropertyChanged();
878 /// Gets or sets the size width of the view.
882 /// Animatable - This property can be animated using <c>Animation</c> class.
885 /// <since_tizen> 3 </since_tizen>
886 public float SizeWidth
890 return (float)GetValue(SizeWidthProperty);
894 SetValue(SizeWidthProperty, value);
895 WidthSpecification = (int)Math.Ceiling(value);
896 NotifyPropertyChanged();
901 /// Gets or sets the size height of the view.
905 /// Animatable - This property can be animated using <c>Animation</c> class.
908 /// <since_tizen> 3 </since_tizen>
909 public float SizeHeight
913 return (float)GetValue(SizeHeightProperty);
917 SetValue(SizeHeightProperty, value);
918 HeightSpecification = (int)Math.Ceiling(value);
919 NotifyPropertyChanged();
924 /// Gets or sets the position of the view.<br />
925 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
926 /// If the position inheritance is disabled, sets the world position.<br />
930 /// Animatable - This property can be animated using <c>Animation</c> class.
932 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
934 /// <since_tizen> 3 </since_tizen>
935 public Position Position
939 Position tmp = (Position)GetValue(PositionProperty);
940 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
944 SetValue(PositionProperty, value);
945 NotifyPropertyChanged();
950 /// Gets or sets the position X of the view.
954 /// Animatable - This property can be animated using <c>Animation</c> class.
957 /// <since_tizen> 3 </since_tizen>
958 public float PositionX
962 return (float)GetValue(PositionXProperty);
966 SetValue(PositionXProperty, value);
967 NotifyPropertyChanged();
972 /// Gets or sets the position Y of the view.
976 /// Animatable - This property can be animated using <c>Animation</c> class.
979 /// <since_tizen> 3 </since_tizen>
980 public float PositionY
984 return (float)GetValue(PositionYProperty);
988 SetValue(PositionYProperty, value);
989 NotifyPropertyChanged();
994 /// Gets or sets the position Z of the view.
998 /// Animatable - This property can be animated using <c>Animation</c> class.
1001 /// <since_tizen> 3 </since_tizen>
1002 public float PositionZ
1006 return (float)GetValue(PositionZProperty);
1010 SetValue(PositionZProperty, value);
1011 NotifyPropertyChanged();
1016 /// Gets or sets the world position of the view.
1018 /// <since_tizen> 3 </since_tizen>
1019 public Vector3 WorldPosition
1023 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1024 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1030 /// Gets or sets the orientation of the view.<br />
1031 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1035 /// This is an asynchronous method.
1038 /// Animatable - This property can be animated using <c>Animation</c> class.
1041 /// <since_tizen> 3 </since_tizen>
1042 public Rotation Orientation
1046 return (Rotation)GetValue(OrientationProperty);
1050 SetValue(OrientationProperty, value);
1051 NotifyPropertyChanged();
1056 /// Gets or sets the world orientation of the view.<br />
1058 /// <since_tizen> 3 </since_tizen>
1059 public Rotation WorldOrientation
1063 Rotation temp = new Rotation();
1064 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1070 /// Gets or sets the scale factor applied to the view.<br />
1074 /// Animatable - This property can be animated using <c>Animation</c> class.
1076 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1078 /// <since_tizen> 3 </since_tizen>
1079 public Vector3 Scale
1083 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1084 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1088 SetValue(ScaleProperty, value);
1089 NotifyPropertyChanged();
1094 /// Gets or sets the scale X factor applied to the view.
1098 /// Animatable - This property can be animated using <c>Animation</c> class.
1101 /// <since_tizen> 3 </since_tizen>
1106 return (float)GetValue(ScaleXProperty);
1110 SetValue(ScaleXProperty, value);
1111 NotifyPropertyChanged();
1116 /// Gets or sets the scale Y 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(ScaleYProperty);
1132 SetValue(ScaleYProperty, value);
1133 NotifyPropertyChanged();
1138 /// Gets or sets the scale Z 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(ScaleZProperty);
1154 SetValue(ScaleZProperty, value);
1155 NotifyPropertyChanged();
1160 /// Gets the world scale of the view.
1162 /// <since_tizen> 3 </since_tizen>
1163 public Vector3 WorldScale
1167 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1168 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1174 /// Retrieves the visibility flag of the view.
1178 /// If the view is not visible, then the view and its children will not be rendered.
1179 /// 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.
1182 /// Animatable - This property can be animated using <c>Animation</c> class.
1185 /// <since_tizen> 3 </since_tizen>
1186 public bool Visibility
1191 GetProperty(View.Property.VISIBLE).Get(out temp);
1197 /// Gets the view's world color.
1199 /// <since_tizen> 3 </since_tizen>
1200 public Vector4 WorldColor
1204 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1205 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1211 /// Gets or sets the view's name.
1213 /// <since_tizen> 3 </since_tizen>
1218 return (string)GetValue(NameProperty);
1222 SetValue(NameProperty, value);
1223 NotifyPropertyChanged();
1228 /// Get the number of children held by the view.
1230 /// <since_tizen> 3 </since_tizen>
1231 public new uint ChildCount
1235 return GetChildCount();
1240 /// Gets the view's ID.
1243 /// <since_tizen> 3 </since_tizen>
1253 /// Gets or sets the status of whether the view should emit touch or hover signals.
1255 /// <since_tizen> 3 </since_tizen>
1256 public bool Sensitive
1260 return (bool)GetValue(SensitiveProperty);
1264 SetValue(SensitiveProperty, value);
1265 NotifyPropertyChanged();
1270 /// 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.
1272 /// <since_tizen> 3 </since_tizen>
1273 public bool LeaveRequired
1277 return (bool)GetValue(LeaveRequiredProperty);
1281 SetValue(LeaveRequiredProperty, value);
1282 NotifyPropertyChanged();
1287 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1289 /// <since_tizen> 3 </since_tizen>
1290 public bool InheritOrientation
1294 return (bool)GetValue(InheritOrientationProperty);
1298 SetValue(InheritOrientationProperty, value);
1299 NotifyPropertyChanged();
1304 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1306 /// <since_tizen> 3 </since_tizen>
1307 public bool InheritScale
1311 return (bool)GetValue(InheritScaleProperty);
1315 SetValue(InheritScaleProperty, value);
1316 NotifyPropertyChanged();
1321 /// Gets or sets the status of how the view and its children should be drawn.<br />
1322 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1323 /// 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 />
1324 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1325 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1326 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1328 /// <since_tizen> 3 </since_tizen>
1329 public DrawModeType DrawMode
1333 return (DrawModeType)GetValue(DrawModeProperty);
1337 SetValue(DrawModeProperty, value);
1338 NotifyPropertyChanged();
1343 /// Gets or sets the relative to parent size factor of the view.<br />
1344 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1345 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1348 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1350 /// <since_tizen> 3 </since_tizen>
1351 public Vector3 SizeModeFactor
1355 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1356 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1360 SetValue(SizeModeFactorProperty, value);
1361 NotifyPropertyChanged();
1366 /// Gets or sets the width resize policy to be used.
1368 /// <since_tizen> 3 </since_tizen>
1369 public ResizePolicyType WidthResizePolicy
1373 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1377 SetValue(WidthResizePolicyProperty, value);
1378 // Match ResizePolicy to new Layouting.
1379 // Parent relative policies can not be mapped at this point as parent size unknown.
1382 case ResizePolicyType.UseNaturalSize:
1384 WidthSpecification = LayoutParamPolicies.WrapContent;
1387 case ResizePolicyType.FillToParent:
1389 WidthSpecification = LayoutParamPolicies.MatchParent;
1392 case ResizePolicyType.FitToChildren:
1394 WidthSpecification = LayoutParamPolicies.WrapContent;
1400 NotifyPropertyChanged();
1405 /// Gets or sets the height resize policy to be used.
1407 /// <since_tizen> 3 </since_tizen>
1408 public ResizePolicyType HeightResizePolicy
1412 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1416 SetValue(HeightResizePolicyProperty, value);
1417 // Match ResizePolicy to new Layouting.
1418 // Parent relative policies can not be mapped at this point as parent size unknown.
1421 case ResizePolicyType.UseNaturalSize:
1423 HeightSpecification = LayoutParamPolicies.WrapContent;
1426 case ResizePolicyType.FillToParent:
1428 HeightSpecification = LayoutParamPolicies.MatchParent;
1431 case ResizePolicyType.FitToChildren:
1433 HeightSpecification = LayoutParamPolicies.WrapContent;
1439 NotifyPropertyChanged();
1444 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1445 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1447 /// <since_tizen> 3 </since_tizen>
1448 public SizeScalePolicyType SizeScalePolicy
1452 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1456 SetValue(SizeScalePolicyProperty, value);
1457 NotifyPropertyChanged();
1462 /// Gets or sets the status of whether the width size is dependent on the height size.
1464 /// <since_tizen> 3 </since_tizen>
1465 public bool WidthForHeight
1469 return (bool)GetValue(WidthForHeightProperty);
1473 SetValue(WidthForHeightProperty, value);
1474 NotifyPropertyChanged();
1479 /// Gets or sets the status of whether the height size is dependent on the width size.
1481 /// <since_tizen> 3 </since_tizen>
1482 public bool HeightForWidth
1486 return (bool)GetValue(HeightForWidthProperty);
1490 SetValue(HeightForWidthProperty, value);
1491 NotifyPropertyChanged();
1496 /// Gets or sets the padding for use in layout.
1499 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1501 /// <since_tizen> 5 </since_tizen>
1502 public Extents Padding
1506 // If View has a Layout then padding in stored in the base Layout class
1509 return Layout.Padding;
1513 Extents temp = (Extents)GetValue(PaddingProperty);
1514 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1516 // Two return points to prevent creating a zeroed Extent native object before assignment
1520 Extents padding = value;
1523 // Layout set so store Padding in LayoutItem instead of in View.
1524 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1525 // the position and sizes measure in the Layouting.
1526 Layout.Padding = value;
1527 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1528 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1529 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1531 padding = new Extents(0,0,0,0); // Reset value stored in View.
1533 _layout?.RequestLayout();
1535 SetValue(PaddingProperty, padding);
1536 NotifyPropertyChanged();
1537 _layout?.RequestLayout();
1542 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1545 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1547 /// <since_tizen> 3 </since_tizen>
1548 public Size2D MinimumSize
1552 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1553 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1557 if (_layout != null)
1559 // Note: it only works if minimum size is >= than natural size.
1560 // To force the size it should be done through the width&height spec or Size2D.
1561 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1562 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1563 _layout.RequestLayout();
1565 SetValue(MinimumSizeProperty, value);
1566 NotifyPropertyChanged();
1571 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1574 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1576 /// <since_tizen> 3 </since_tizen>
1577 public Size2D MaximumSize
1581 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1582 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1586 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1587 // MATCH_PARENT spec + parent container size can be used to limit
1588 if (_layout != null)
1590 // Note: it only works if minimum size is >= than natural size.
1591 // To force the size it should be done through the width&height spec or Size2D.
1592 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1593 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1594 _layout.RequestLayout();
1596 SetValue(MaximumSizeProperty, value);
1597 NotifyPropertyChanged();
1602 /// Gets or sets whether a child view inherits it's parent's position.<br />
1603 /// Default is to inherit.<br />
1604 /// 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 />
1606 /// <since_tizen> 3 </since_tizen>
1607 public bool InheritPosition
1611 return (bool)GetValue(InheritPositionProperty);
1615 SetValue(InheritPositionProperty, value);
1616 NotifyPropertyChanged();
1621 /// Gets or sets the clipping behavior (mode) of it's children.
1623 /// <since_tizen> 3 </since_tizen>
1624 public ClippingModeType ClippingMode
1628 return (ClippingModeType)GetValue(ClippingModeProperty);
1632 SetValue(ClippingModeProperty, value);
1633 NotifyPropertyChanged();
1638 /// Gets the number of renderers held by the view.
1640 /// <since_tizen> 3 </since_tizen>
1641 public uint RendererCount
1645 return GetRendererCount();
1650 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1653 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1655 /// <since_tizen> 3 </since_tizen>
1656 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1658 "View view = new View(); " +
1659 "view.PivotPoint = PivotPoint.Center; " +
1660 "view.PositionUsesPivotPoint = true;")]
1661 [EditorBrowsable(EditorBrowsableState.Never)]
1662 public Position AnchorPoint
1666 Position temp = new Position(0.0f, 0.0f, 0.0f);
1667 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1668 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1672 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1673 NotifyPropertyChanged();
1678 /// Sets the size of a view for the width, the height and the depth.<br />
1679 /// Geometry can be scaled to fit within this area.<br />
1680 /// This does not interfere with the view's scale factor.<br />
1681 /// The views default depth is the minimum of width and height.<br />
1685 /// Animatable - This property can be animated using <c>Animation</c> class.
1687 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1689 /// <since_tizen> 5 </since_tizen>
1694 Size tmp = (Size)GetValue(SizeProperty);
1695 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1699 SetValue(SizeProperty, value);
1700 // Set Specification so when layouts measure this View it matches the value set here.
1701 // All Views are currently Layouts.
1702 WidthSpecification = (int)Math.Ceiling(value.Width);
1703 HeightSpecification = (int)Math.Ceiling(value.Height);
1704 NotifyPropertyChanged();
1709 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1711 /// <since_tizen> 3 </since_tizen>
1712 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1714 "Container parent = view.GetParent(); " +
1715 "View view = parent as View;")]
1716 [EditorBrowsable(EditorBrowsableState.Never)]
1717 public new View Parent
1722 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1723 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1724 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1726 if (basehandle is Layer layer)
1728 ret = new View(Layer.getCPtr(layer).Handle, false);
1729 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1733 ret = basehandle as View;
1736 Interop.BaseHandle.delete_BaseHandle(CPtr);
1737 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1739 if (NDalicPINVOKE.SWIGPendingException.Pending)
1740 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1746 /// Gets/Sets whether inherit parent's the layout Direction.
1748 /// <since_tizen> 4 </since_tizen>
1749 public bool InheritLayoutDirection
1753 return (bool)GetValue(InheritLayoutDirectionProperty);
1757 SetValue(InheritLayoutDirectionProperty, value);
1758 NotifyPropertyChanged();
1763 /// Gets/Sets the layout Direction.
1765 /// <since_tizen> 4 </since_tizen>
1766 public ViewLayoutDirectionType LayoutDirection
1770 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1774 SetValue(LayoutDirectionProperty, value);
1775 NotifyPropertyChanged();
1776 _layout?.RequestLayout();
1781 /// Gets or sets the Margin for use in layout.
1784 /// Margin property is supported by Layout algorithms and containers.
1785 /// Please Set Layout if you want to use Margin property.
1786 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1788 /// <since_tizen> 4 </since_tizen>
1789 public Extents Margin
1793 // If View has a Layout then margin is stored in Layout.
1796 return Layout.Margin;
1800 // If Layout not set then return margin stored in View.
1801 Extents temp = (Extents)GetValue(MarginProperty);
1802 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1804 // Two return points to prevent creating a zeroed Extent native object before assignment
1810 // Layout set so store Margin in LayoutItem instead of View.
1811 // If View stores the Margin too then the Legacy Size Negotiation will
1812 // overwrite the position and size values measured in the Layouting.
1813 Layout.Margin = value;
1814 SetValue(MarginProperty, new Extents(0,0,0,0));
1815 _layout?.RequestLayout();
1819 SetValue(MarginProperty, value);
1821 NotifyPropertyChanged();
1822 _layout?.RequestLayout();
1827 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1829 /// <since_tizen> 6 </since_tizen>
1830 public int WidthSpecification
1834 return _widthPolicy;
1838 _widthPolicy = value;
1839 if (_widthPolicy >= 0)
1841 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1843 if(_heightPolicy>=0) // Policy an exact value
1845 Size2D.Width = _widthPolicy;
1849 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1850 // Size2D height will store the specification value (negative number) this will then be applied to the
1851 // HeightSpecification when the Size2D callback is invoked.
1852 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1855 _layout?.RequestLayout();
1860 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1862 /// <since_tizen> 6 </since_tizen>
1863 public int HeightSpecification
1867 return _heightPolicy;
1871 _heightPolicy = value;
1872 if (_heightPolicy >= 0)
1874 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1876 if(_widthPolicy>=0) // Policy an exact value
1878 Size2D.Height = _heightPolicy;
1882 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1883 // Size2D height will store the specification value (negative number) this will then be applied to the
1884 // HeightSpecification when the Size2D callback is invoked.
1885 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1889 _layout?.RequestLayout();
1894 /// Gets the List of transitions for this View.
1896 /// <since_tizen> 6 </since_tizen>
1897 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
1901 if (_layoutTransitions == null)
1903 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1905 return _layoutTransitions;
1910 /// Set a layout transitions for this View.
1913 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
1915 /// <since_tizen> 6 </since_tizen>
1916 public LayoutTransition LayoutTransition
1920 if (_layoutTransitions == null)
1922 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1924 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
1926 AttachTransitionsToChildren(value);
1931 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
1934 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1936 /// <since_tizen> 4 </since_tizen>
1937 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
1938 [EditorBrowsable(EditorBrowsableState.Never)]
1939 public Extents PaddingEX
1943 Extents temp = new Extents(0, 0, 0, 0);
1944 GetProperty(View.Property.PADDING).Get(temp);
1945 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1949 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
1950 NotifyPropertyChanged();
1951 _layout?.RequestLayout();
1955 /// <since_tizen> 6 </since_tizen>
1956 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1957 [EditorBrowsable(EditorBrowsableState.Never)]
1958 public Style XamlStyle
1962 return (Style)GetValue(XamlStyleProperty);
1966 SetValue(XamlStyleProperty, value);
1971 /// The Color of View. This is an RGBA value.
1975 /// Animatable - This property can be animated using <c>Animation</c> class.
1977 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
1979 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1980 [EditorBrowsable(EditorBrowsableState.Never)]
1985 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1986 GetProperty(Interop.ActorProperty.Actor_Property_COLOR_get()).Get(temp);
1987 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
1996 /// Set the layout on this View. Replaces any existing Layout.
1998 /// <since_tizen> 6 </since_tizen>
1999 public LayoutItem Layout
2007 // Do nothing if layout provided is already set on this View.
2008 if (value == _layout)
2013 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2014 layoutingDisabled = false;
2017 // If new layout being set already has a owner then that owner receives a replacement default layout.
2018 // First check if the layout to be set already has a owner.
2019 if (value?.Owner != null)
2021 // Previous owner of the layout gets a default layout as a replacement.
2022 value.Owner.Layout = new LayoutGroup();
2024 // Copy Margin and Padding to replacement LayoutGroup.
2025 value.Owner.Layout.Margin = value.Margin;
2026 value.Owner.Layout.Padding = value.Padding;
2029 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2030 // View if no replacement. Previously margin and padding values would have been moved from
2031 // the View to the layout.
2032 if (_layout != null ) // Existing layout
2036 // Existing layout being replaced so copy over margin and padding values.
2037 value.Margin = _layout.Margin;
2038 value.Padding = _layout.Padding;
2042 // Layout not being replaced so restore margin and padding to View.
2043 SetValue(MarginProperty, _layout.Margin);
2044 SetValue(PaddingProperty, _layout.Padding);
2045 NotifyPropertyChanged();
2050 // First Layout to be added to the View hence copy
2052 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2055 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2057 // If View already has a margin set then store it in Layout instead.
2058 value.Margin = Margin;
2059 SetValue(MarginProperty, new Extents(0,0,0,0));
2060 NotifyPropertyChanged();
2063 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2065 // If View already has a padding set then store it in Layout instead.
2066 value.Padding = Padding;
2067 SetValue(PaddingProperty, new Extents(0,0,0,0));
2068 NotifyPropertyChanged();
2073 // Remove existing layout from it's parent layout group.
2074 _layout?.Unparent();
2076 // Set layout to this view
2082 /// The weight of the View, used to share available space in a layout with siblings.
2084 /// <since_tizen> 6 </since_tizen>
2094 _layout?.RequestLayout();
2099 /// Whether to load the BackgroundImage synchronously.
2100 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2101 /// Note: For Normal Quad images only.
2103 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2104 [EditorBrowsable(EditorBrowsableState.Never)]
2105 public bool BackgroundImageSynchronosLoading
2109 return _backgroundImageSynchronosLoading;
2113 _backgroundImageSynchronosLoading = value;
2116 Background.Find(Visual.Property.Type)?.Get(out visualType);
2117 if (visualType == (int)Visual.Type.Image)
2119 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2122 if (bgUrl.Length != 0)
2124 PropertyMap bgMap = this.Background;
2125 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2131 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2132 [EditorBrowsable(EditorBrowsableState.Never)]
2133 public Vector2 UpdateSizeHint
2137 return (Vector2)GetValue(UpdateSizeHintProperty);
2141 SetValue(UpdateSizeHintProperty, value);
2142 NotifyPropertyChanged();
2146 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2147 [EditorBrowsable(EditorBrowsableState.Never)]
2148 public string[] TransitionNames
2152 return transitionNames;
2156 transitionNames = value;
2162 /// Get attribues, it is abstract function and must be override.
2164 /// <since_tizen> 6 </since_tizen>
2165 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2166 [EditorBrowsable(EditorBrowsableState.Never)]
2167 protected virtual ViewStyle GetViewStyle()
2169 viewStyle = new ViewStyle();
2173 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2175 var view = (View)bindable;
2176 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2178 defaultValueCreator: (bindable) =>
2180 var view = (View)bindable;
2181 return view.backgroundColorSelector;
2183 private TriggerableSelector<Color> _backgroundColorSelector;
2184 private TriggerableSelector<Color> backgroundColorSelector
2188 if (null == _backgroundColorSelector)
2190 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2192 return _backgroundColorSelector;
2196 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2198 var view = (View)bindable;
2199 view.opacitySelector.Clone((Selector<float?>)newValue);
2201 defaultValueCreator: (bindable) =>
2203 var view = (View)bindable;
2204 return view.opacitySelector;
2206 private TriggerableSelector<float?> _opacitySelector;
2207 private TriggerableSelector<float?> opacitySelector
2211 if (null == _opacitySelector)
2213 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2215 return _opacitySelector;
2219 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2220 [EditorBrowsable(EditorBrowsableState.Never)]
2221 public virtual void ApplyStyle(ViewStyle viewStyle)
2223 if (null == viewStyle)
2228 if (this.viewStyle == viewStyle)
2233 if (null != this.viewStyle)
2235 simpleBinding.Clear();
2238 this.viewStyle = viewStyle;
2240 Dictionary<string, BindableProperty> bindablePropertyOfView;
2241 Type viewType = GetType();
2243 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2244 Type styleType = viewStyle.GetType();
2246 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2247 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2249 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2251 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2253 BindableProperty viewProperty;
2254 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2256 if (null != viewProperty)
2258 object value = viewStyle.GetValue(keyValuePair.Value);
2262 SetValue(viewProperty, value);
2265 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2271 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2272 [EditorBrowsable(EditorBrowsableState.Never)]
2273 private BundledPipe simpleBinding = new BundledPipe();