2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
33 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
35 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public bool layoutSet = false;
40 /// Flag to allow Layouting to be disabled for Views.
41 /// Once a View has a Layout set then any children added to Views from then on will receive
42 /// automatic Layouts.
44 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public static bool layoutingDisabled{get; set;} = true;
48 private LayoutItem _layout; // Exclusive layout assigned to this View.
50 // List of transitions paired with the condition that uses the transition.
51 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54 private float _weight = 0.0f; // Weighting of child View in a Layout
55 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
56 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
57 private bool _backgroundImageSynchronosLoading = false;
58 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
59 private string[] transitionNames;
60 private Rectangle backgroundImageBorder;
62 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
64 private ViewStyle viewStyle;
65 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
66 [EditorBrowsable(EditorBrowsableState.Never)]
67 public ViewStyle ViewStyle
71 if (null == viewStyle)
73 ApplyStyle(GetViewStyle());
81 /// Creates a new instance of a view.
83 /// <since_tizen> 3 </since_tizen>
84 public View() : this(Interop.View.View_New(), true)
86 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
90 [EditorBrowsable(EditorBrowsableState.Never)]
91 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
93 this.ViewStyle.CopyFrom(viewStyle);
97 /// Create a new instance of a View with setting the status of shown or hidden.
99 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
100 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
101 [EditorBrowsable(EditorBrowsableState.Never)]
102 public View(bool shown) : this(Interop.View.View_New(), true)
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
119 this.ViewStyle.CopyFrom(viewStyle);
122 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
126 PositionUsesPivotPoint = false;
129 _onWindowSendEventCallback = SendViewAddedEventToWindow;
130 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
138 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
140 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148 internal delegate void ControlStateChangesDelegate(View obj, ControlStates state);
149 internal event ControlStateChangesDelegate ControlStateChangeEvent;
151 private ControlStates controlStates;
153 /// Get/Set the control state.
155 /// <since_tizen> 6 </since_tizen>
156 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
157 [EditorBrowsable(EditorBrowsableState.Never)]
158 public ControlStates ControlState
162 return controlStates;
166 if (controlStates != value)
168 controlStates = value;
170 ControlStateChangeEvent?.Invoke(this, value);
172 if (true == OnControlStateChanged(value))
174 foreach (View child in Children)
176 child.ControlState = value;
183 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
184 [EditorBrowsable(EditorBrowsableState.Never)]
185 public bool IsResourcesCreated
189 return Application.Current.IsResourcesCreated;
193 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
194 [EditorBrowsable(EditorBrowsableState.Never)]
195 public ResourceDictionary XamlResources
199 return Application.Current.XamlResources;
203 Application.Current.XamlResources = value;
208 /// The StyleName, type string.
210 /// <since_tizen> 3 </since_tizen>
211 public string StyleName
215 return (string)GetValue(StyleNameProperty);
219 SetValue(StyleNameProperty, value);
220 NotifyPropertyChanged();
225 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
228 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
230 /// <since_tizen> 3 </since_tizen>
231 public Color BackgroundColor
235 Color temp = (Color)GetValue(BackgroundColorProperty);
236 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
240 SetValue(BackgroundColorProperty, value);
241 NotifyPropertyChanged();
246 /// The mutually exclusive with "backgroundColor" and "background" type Map.
248 /// <since_tizen> 3 </since_tizen>
249 public string BackgroundImage
253 return (string)GetValue(BackgroundImageProperty);
257 SetValue(BackgroundImageProperty, value);
258 NotifyPropertyChanged();
263 /// Get or set the border of background image.
265 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
266 [EditorBrowsable(EditorBrowsableState.Never)]
267 public Rectangle BackgroundImageBorder
271 return (Rectangle)GetValue(BackgroundImageBorderProperty);
275 SetValue(BackgroundImageBorderProperty, value);
276 NotifyPropertyChanged();
281 /// The background of view.
283 /// <since_tizen> 3 </since_tizen>
284 public Tizen.NUI.PropertyMap Background
288 return (PropertyMap)GetValue(BackgroundProperty);
292 SetValue(BackgroundProperty, value);
293 NotifyPropertyChanged();
298 /// The current state of the view.
300 /// <since_tizen> 3 </since_tizen>
305 return (States)GetValue(StateProperty);
309 SetValue(StateProperty, value);
310 NotifyPropertyChanged();
315 /// The current sub state of the view.
317 /// <since_tizen> 3 </since_tizen>
318 public States SubState
322 return (States)GetValue(SubStateProperty);
326 SetValue(SubStateProperty, value);
327 NotifyPropertyChanged();
332 /// Displays a tooltip
334 /// <since_tizen> 3 </since_tizen>
335 public Tizen.NUI.PropertyMap Tooltip
339 return (PropertyMap)GetValue(TooltipProperty);
343 SetValue(TooltipProperty, value);
344 NotifyPropertyChanged();
349 /// Displays a tooltip as a text.
351 /// <since_tizen> 3 </since_tizen>
352 public string TooltipText
356 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
357 NotifyPropertyChanged();
362 /// The Child property of FlexContainer.<br />
363 /// The proportion of the free space in the container, the flex item will receive.<br />
364 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
366 /// <since_tizen> 3 </since_tizen>
371 return (float)GetValue(FlexProperty);
375 SetValue(FlexProperty, value);
376 NotifyPropertyChanged();
381 /// The Child property of FlexContainer.<br />
382 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
384 /// <since_tizen> 3 </since_tizen>
389 return (int)GetValue(AlignSelfProperty);
393 SetValue(AlignSelfProperty, value);
394 NotifyPropertyChanged();
399 /// The Child property of FlexContainer.<br />
400 /// The space around the flex item.<br />
403 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
405 /// <since_tizen> 3 </since_tizen>
406 public Vector4 FlexMargin
410 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
411 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
415 SetValue(FlexMarginProperty, value);
416 NotifyPropertyChanged();
421 /// The top-left cell this child occupies, if not set, the first available cell is used.
424 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
426 /// <since_tizen> 3 </since_tizen>
427 public Vector2 CellIndex
431 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
432 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
436 SetValue(CellIndexProperty, value);
437 NotifyPropertyChanged();
442 /// The number of rows this child occupies, if not set, the default value is 1.
444 /// <since_tizen> 3 </since_tizen>
449 return (float)GetValue(RowSpanProperty);
453 SetValue(RowSpanProperty, value);
454 NotifyPropertyChanged();
459 /// The number of columns this child occupies, if not set, the default value is 1.
461 /// <since_tizen> 3 </since_tizen>
462 public float ColumnSpan
466 return (float)GetValue(ColumnSpanProperty);
470 SetValue(ColumnSpanProperty, value);
471 NotifyPropertyChanged();
476 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
478 /// <since_tizen> 3 </since_tizen>
479 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
483 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
487 SetValue(CellHorizontalAlignmentProperty, value);
488 NotifyPropertyChanged();
493 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
495 /// <since_tizen> 3 </since_tizen>
496 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
500 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
504 SetValue(CellVerticalAlignmentProperty, value);
505 NotifyPropertyChanged();
510 /// The left focusable view.<br />
511 /// This will return null if not set.<br />
512 /// This will also return null if the specified left focusable view is not on a window.<br />
514 /// <since_tizen> 3 </since_tizen>
515 public View LeftFocusableView
517 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
520 return (View)GetValue(LeftFocusableViewProperty);
524 SetValue(LeftFocusableViewProperty, value);
525 NotifyPropertyChanged();
530 /// The right focusable view.<br />
531 /// This will return null if not set.<br />
532 /// This will also return null if the specified right focusable view is not on a window.<br />
534 /// <since_tizen> 3 </since_tizen>
535 public View RightFocusableView
537 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
540 return (View)GetValue(RightFocusableViewProperty);
544 SetValue(RightFocusableViewProperty, value);
545 NotifyPropertyChanged();
550 /// The up focusable view.<br />
551 /// This will return null if not set.<br />
552 /// This will also return null if the specified up focusable view is not on a window.<br />
554 /// <since_tizen> 3 </since_tizen>
555 public View UpFocusableView
557 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
560 return (View)GetValue(UpFocusableViewProperty);
564 SetValue(UpFocusableViewProperty, value);
565 NotifyPropertyChanged();
570 /// The down focusable view.<br />
571 /// This will return null if not set.<br />
572 /// This will also return null if the specified down focusable view is not on a window.<br />
574 /// <since_tizen> 3 </since_tizen>
575 public View DownFocusableView
577 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
580 return (View)GetValue(DownFocusableViewProperty);
584 SetValue(DownFocusableViewProperty, value);
585 NotifyPropertyChanged();
590 /// Whether the view should be focusable by keyboard navigation.
592 /// <since_tizen> 3 </since_tizen>
593 public bool Focusable
597 SetValue(FocusableProperty, value);
598 NotifyPropertyChanged();
602 return (bool)GetValue(FocusableProperty);
607 /// Retrieves the position of the view.<br />
608 /// The coordinates are relative to the view's parent.<br />
610 /// <since_tizen> 3 </since_tizen>
611 public Position CurrentPosition
615 return GetCurrentPosition();
620 /// Sets the size of a view for the width and the height.<br />
621 /// Geometry can be scaled to fit within this area.<br />
622 /// This does not interfere with the view's scale factor.<br />
623 /// The views default depth is the minimum of width and height.<br />
626 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
627 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
629 /// <since_tizen> 3 </since_tizen>
634 Size2D temp = (Size2D)GetValue(Size2DProperty);
635 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
639 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
640 SetValue(Size2DProperty, value);
641 // Set Specification so when layouts measure this View it matches the value set here.
642 // All Views are currently Layouts.
643 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
644 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
645 _widthPolicy = value.Width;
646 _heightPolicy = value.Height;
647 _layout?.RequestLayout();
648 NotifyPropertyChanged();
653 /// Retrieves the size of the view.<br />
654 /// The coordinates are relative to the view's parent.<br />
656 /// <since_tizen> 3 </since_tizen>
657 public Size2D CurrentSize
661 return GetCurrentSize();
666 /// Retrieves and sets the view's opacity.<br />
670 /// Animatable - This property can be animated using <c>Animation</c> class.
673 /// <since_tizen> 3 </since_tizen>
678 return (float)GetValue(OpacityProperty);
682 SetValue(OpacityProperty, value);
683 NotifyPropertyChanged();
688 /// Sets the position of the view for X and Y.<br />
689 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
690 /// If the position inheritance is disabled, sets the world position.<br />
693 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
694 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
696 /// <since_tizen> 3 </since_tizen>
697 public Position2D Position2D
701 Position2D temp = (Position2D)GetValue(Position2DProperty);
702 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
706 SetValue(Position2DProperty, value);
707 NotifyPropertyChanged();
712 /// Retrieves the screen postion of the view.<br />
714 /// <since_tizen> 3 </since_tizen>
715 public Vector2 ScreenPosition
719 Vector2 temp = new Vector2(0.0f, 0.0f);
720 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
726 /// Determines whether the pivot point should be used to determine the position of the view.
727 /// This is true by default.
729 /// <remarks>If false, then the top-left of the view is used for the position.
730 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
732 /// <since_tizen> 3 </since_tizen>
733 public bool PositionUsesPivotPoint
737 return (bool)GetValue(PositionUsesPivotPointProperty);
741 SetValue(PositionUsesPivotPointProperty, value);
742 NotifyPropertyChanged();
747 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
749 /// <since_tizen> 3 </since_tizen>
750 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
752 "View view = new View(); " +
753 "view.PivotPoint = PivotPoint.Center; " +
754 "view.PositionUsesPivotPoint = true;" +
755 " Deprecated in API5: Will be removed in API8")]
756 [EditorBrowsable(EditorBrowsableState.Never)]
757 public bool PositionUsesAnchorPoint
762 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
767 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
768 NotifyPropertyChanged();
773 /// Queries whether the view is connected to the stage.<br />
774 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
776 /// <since_tizen> 3 </since_tizen>
777 public bool IsOnWindow
786 /// Gets the depth in the hierarchy for the view.
788 /// <since_tizen> 3 </since_tizen>
789 public int HierarchyDepth
793 return GetHierarchyDepth();
798 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
801 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
802 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
803 /// The values set by this property will likely change.
805 /// <since_tizen> 3 </since_tizen>
806 public int SiblingOrder
810 return (int)GetValue(SiblingOrderProperty);
814 SetValue(SiblingOrderProperty, value);
815 NotifyPropertyChanged();
820 /// Returns the natural size of the view.
823 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
825 /// <since_tizen> 5 </since_tizen>
826 public Vector3 NaturalSize
830 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
831 if (NDalicPINVOKE.SWIGPendingException.Pending)
832 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
838 /// Returns the natural size (Size2D) of the view.
841 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
843 /// <since_tizen> 4 </since_tizen>
844 public Size2D NaturalSize2D
848 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
849 if (NDalicPINVOKE.SWIGPendingException.Pending)
850 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
852 return new Size2D((int)temp.Width, (int)temp.Height);
857 /// Gets or sets the origin of a view within its parent's area.<br />
858 /// 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 />
859 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
860 /// A view's position is the distance between this origin and the view's anchor-point.<br />
862 /// <pre>The view has been initialized.</pre>
863 /// <since_tizen> 3 </since_tizen>
864 public Position ParentOrigin
868 Position tmp = (Position)GetValue(ParentOriginProperty);
869 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
873 SetValue(ParentOriginProperty, value);
874 NotifyPropertyChanged();
879 /// Gets or sets the anchor-point of a view.<br />
880 /// 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 />
881 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
882 /// A view position is the distance between its parent-origin and this anchor-point.<br />
883 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
884 /// <pre>The view has been initialized.</pre>
887 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
889 /// <since_tizen> 3 </since_tizen>
890 public Position PivotPoint
894 Position tmp = (Position)GetValue(PivotPointProperty);
895 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
899 SetValue(PivotPointProperty, value);
900 NotifyPropertyChanged();
905 /// Gets or sets the size width of the view.
909 /// Animatable - This property can be animated using <c>Animation</c> class.
912 /// <since_tizen> 3 </since_tizen>
913 public float SizeWidth
917 return (float)GetValue(SizeWidthProperty);
921 SetValue(SizeWidthProperty, value);
922 WidthSpecification = (int)Math.Ceiling(value);
923 NotifyPropertyChanged();
928 /// Gets or sets the size height of the view.
932 /// Animatable - This property can be animated using <c>Animation</c> class.
935 /// <since_tizen> 3 </since_tizen>
936 public float SizeHeight
940 return (float)GetValue(SizeHeightProperty);
944 SetValue(SizeHeightProperty, value);
945 HeightSpecification = (int)Math.Ceiling(value);
946 NotifyPropertyChanged();
951 /// Gets or sets the position of the view.<br />
952 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
953 /// If the position inheritance is disabled, sets the world position.<br />
957 /// Animatable - This property can be animated using <c>Animation</c> class.
959 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
961 /// <since_tizen> 3 </since_tizen>
962 public Position Position
966 Position tmp = (Position)GetValue(PositionProperty);
967 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
971 SetValue(PositionProperty, value);
972 NotifyPropertyChanged();
977 /// Gets or sets the position X of the view.
981 /// Animatable - This property can be animated using <c>Animation</c> class.
984 /// <since_tizen> 3 </since_tizen>
985 public float PositionX
989 return (float)GetValue(PositionXProperty);
993 SetValue(PositionXProperty, value);
994 NotifyPropertyChanged();
999 /// Gets or sets the position Y of the view.
1003 /// Animatable - This property can be animated using <c>Animation</c> class.
1006 /// <since_tizen> 3 </since_tizen>
1007 public float PositionY
1011 return (float)GetValue(PositionYProperty);
1015 SetValue(PositionYProperty, value);
1016 NotifyPropertyChanged();
1021 /// Gets or sets the position Z of the view.
1025 /// Animatable - This property can be animated using <c>Animation</c> class.
1028 /// <since_tizen> 3 </since_tizen>
1029 public float PositionZ
1033 return (float)GetValue(PositionZProperty);
1037 SetValue(PositionZProperty, value);
1038 NotifyPropertyChanged();
1043 /// Gets or sets the world position of the view.
1045 /// <since_tizen> 3 </since_tizen>
1046 public Vector3 WorldPosition
1050 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1051 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1057 /// Gets or sets the orientation of the view.<br />
1058 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1062 /// This is an asynchronous method.
1065 /// Animatable - This property can be animated using <c>Animation</c> class.
1068 /// <since_tizen> 3 </since_tizen>
1069 public Rotation Orientation
1073 return (Rotation)GetValue(OrientationProperty);
1077 SetValue(OrientationProperty, value);
1078 NotifyPropertyChanged();
1083 /// Gets or sets the world orientation of the view.<br />
1085 /// <since_tizen> 3 </since_tizen>
1086 public Rotation WorldOrientation
1090 Rotation temp = new Rotation();
1091 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1097 /// Gets or sets the scale factor applied to the view.<br />
1101 /// Animatable - This property can be animated using <c>Animation</c> class.
1103 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1105 /// <since_tizen> 3 </since_tizen>
1106 public Vector3 Scale
1110 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1111 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1115 SetValue(ScaleProperty, value);
1116 NotifyPropertyChanged();
1121 /// Gets or sets the scale X 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(ScaleXProperty);
1137 SetValue(ScaleXProperty, value);
1138 NotifyPropertyChanged();
1143 /// Gets or sets the scale Y 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(ScaleYProperty);
1159 SetValue(ScaleYProperty, value);
1160 NotifyPropertyChanged();
1165 /// Gets or sets the scale Z factor applied to the view.
1169 /// Animatable - This property can be animated using <c>Animation</c> class.
1172 /// <since_tizen> 3 </since_tizen>
1177 return (float)GetValue(ScaleZProperty);
1181 SetValue(ScaleZProperty, value);
1182 NotifyPropertyChanged();
1187 /// Gets the world scale of the view.
1189 /// <since_tizen> 3 </since_tizen>
1190 public Vector3 WorldScale
1194 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1195 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1201 /// Retrieves the visibility flag of the view.
1205 /// If the view is not visible, then the view and its children will not be rendered.
1206 /// 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.
1209 /// <since_tizen> 3 </since_tizen>
1210 public bool Visibility
1215 GetProperty(View.Property.VISIBLE).Get(out temp);
1221 /// Gets the view's world color.
1223 /// <since_tizen> 3 </since_tizen>
1224 public Vector4 WorldColor
1228 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1229 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1235 /// Gets or sets the view's name.
1237 /// <since_tizen> 3 </since_tizen>
1242 return (string)GetValue(NameProperty);
1246 SetValue(NameProperty, value);
1247 NotifyPropertyChanged();
1252 /// Get the number of children held by the view.
1254 /// <since_tizen> 3 </since_tizen>
1255 public new uint ChildCount
1259 return GetChildCount();
1264 /// Gets the view's ID.
1267 /// <since_tizen> 3 </since_tizen>
1277 /// Gets or sets the status of whether the view should emit touch or hover signals.
1279 /// <since_tizen> 3 </since_tizen>
1280 public bool Sensitive
1284 return (bool)GetValue(SensitiveProperty);
1288 SetValue(SensitiveProperty, value);
1289 NotifyPropertyChanged();
1294 /// 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.
1296 /// <since_tizen> 3 </since_tizen>
1297 public bool LeaveRequired
1301 return (bool)GetValue(LeaveRequiredProperty);
1305 SetValue(LeaveRequiredProperty, value);
1306 NotifyPropertyChanged();
1311 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1313 /// <since_tizen> 3 </since_tizen>
1314 public bool InheritOrientation
1318 return (bool)GetValue(InheritOrientationProperty);
1322 SetValue(InheritOrientationProperty, value);
1323 NotifyPropertyChanged();
1328 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1330 /// <since_tizen> 3 </since_tizen>
1331 public bool InheritScale
1335 return (bool)GetValue(InheritScaleProperty);
1339 SetValue(InheritScaleProperty, value);
1340 NotifyPropertyChanged();
1345 /// Gets or sets the status of how the view and its children should be drawn.<br />
1346 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1347 /// 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 />
1348 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1349 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1350 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1352 /// <since_tizen> 3 </since_tizen>
1353 public DrawModeType DrawMode
1357 return (DrawModeType)GetValue(DrawModeProperty);
1361 SetValue(DrawModeProperty, value);
1362 NotifyPropertyChanged();
1367 /// Gets or sets the relative to parent size factor of the view.<br />
1368 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1369 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1372 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1374 /// <since_tizen> 3 </since_tizen>
1375 public Vector3 SizeModeFactor
1379 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1380 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1384 SetValue(SizeModeFactorProperty, value);
1385 NotifyPropertyChanged();
1390 /// Gets or sets the width resize policy to be used.
1392 /// <since_tizen> 3 </since_tizen>
1393 public ResizePolicyType WidthResizePolicy
1397 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1401 SetValue(WidthResizePolicyProperty, value);
1402 // Match ResizePolicy to new Layouting.
1403 // Parent relative policies can not be mapped at this point as parent size unknown.
1406 case ResizePolicyType.UseNaturalSize:
1408 WidthSpecification = LayoutParamPolicies.WrapContent;
1411 case ResizePolicyType.FillToParent:
1413 WidthSpecification = LayoutParamPolicies.MatchParent;
1416 case ResizePolicyType.FitToChildren:
1418 WidthSpecification = LayoutParamPolicies.WrapContent;
1424 NotifyPropertyChanged();
1429 /// Gets or sets the height resize policy to be used.
1431 /// <since_tizen> 3 </since_tizen>
1432 public ResizePolicyType HeightResizePolicy
1436 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1440 SetValue(HeightResizePolicyProperty, value);
1441 // Match ResizePolicy to new Layouting.
1442 // Parent relative policies can not be mapped at this point as parent size unknown.
1445 case ResizePolicyType.UseNaturalSize:
1447 HeightSpecification = LayoutParamPolicies.WrapContent;
1450 case ResizePolicyType.FillToParent:
1452 HeightSpecification = LayoutParamPolicies.MatchParent;
1455 case ResizePolicyType.FitToChildren:
1457 HeightSpecification = LayoutParamPolicies.WrapContent;
1463 NotifyPropertyChanged();
1468 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1469 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1471 /// <since_tizen> 3 </since_tizen>
1472 public SizeScalePolicyType SizeScalePolicy
1476 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1480 SetValue(SizeScalePolicyProperty, value);
1481 NotifyPropertyChanged();
1486 /// Gets or sets the status of whether the width size is dependent on the height size.
1488 /// <since_tizen> 3 </since_tizen>
1489 public bool WidthForHeight
1493 return (bool)GetValue(WidthForHeightProperty);
1497 SetValue(WidthForHeightProperty, value);
1498 NotifyPropertyChanged();
1503 /// Gets or sets the status of whether the height size is dependent on the width size.
1505 /// <since_tizen> 3 </since_tizen>
1506 public bool HeightForWidth
1510 return (bool)GetValue(HeightForWidthProperty);
1514 SetValue(HeightForWidthProperty, value);
1515 NotifyPropertyChanged();
1520 /// Gets or sets the padding for use in layout.
1523 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1525 /// <since_tizen> 5 </since_tizen>
1526 public Extents Padding
1530 // If View has a Layout then padding in stored in the base Layout class
1533 return Layout.Padding;
1537 Extents temp = (Extents)GetValue(PaddingProperty);
1538 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1540 // Two return points to prevent creating a zeroed Extent native object before assignment
1544 Extents padding = value;
1547 // Layout set so store Padding in LayoutItem instead of in View.
1548 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1549 // the position and sizes measure in the Layouting.
1550 Layout.Padding = value;
1551 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1552 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1553 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1555 padding = new Extents(0,0,0,0); // Reset value stored in View.
1557 _layout?.RequestLayout();
1559 SetValue(PaddingProperty, padding);
1560 NotifyPropertyChanged();
1561 _layout?.RequestLayout();
1566 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1569 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1571 /// <since_tizen> 3 </since_tizen>
1572 public Size2D MinimumSize
1576 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1577 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1581 if (_layout != null)
1583 // Note: it only works if minimum size is >= than natural size.
1584 // To force the size it should be done through the width&height spec or Size2D.
1585 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1586 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1587 _layout.RequestLayout();
1589 SetValue(MinimumSizeProperty, value);
1590 NotifyPropertyChanged();
1595 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1598 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1600 /// <since_tizen> 3 </since_tizen>
1601 public Size2D MaximumSize
1605 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1606 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1610 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1611 // MATCH_PARENT spec + parent container size can be used to limit
1612 if (_layout != null)
1614 // Note: it only works if minimum size is >= than natural size.
1615 // To force the size it should be done through the width&height spec or Size2D.
1616 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1617 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1618 _layout.RequestLayout();
1620 SetValue(MaximumSizeProperty, value);
1621 NotifyPropertyChanged();
1626 /// Gets or sets whether a child view inherits it's parent's position.<br />
1627 /// Default is to inherit.<br />
1628 /// 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 />
1630 /// <since_tizen> 3 </since_tizen>
1631 public bool InheritPosition
1635 return (bool)GetValue(InheritPositionProperty);
1639 SetValue(InheritPositionProperty, value);
1640 NotifyPropertyChanged();
1645 /// Gets or sets the clipping behavior (mode) of it's children.
1647 /// <since_tizen> 3 </since_tizen>
1648 public ClippingModeType ClippingMode
1652 return (ClippingModeType)GetValue(ClippingModeProperty);
1656 SetValue(ClippingModeProperty, value);
1657 NotifyPropertyChanged();
1662 /// Gets the number of renderers held by the view.
1664 /// <since_tizen> 3 </since_tizen>
1665 public uint RendererCount
1669 return GetRendererCount();
1674 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1677 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1679 /// <since_tizen> 3 </since_tizen>
1680 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1682 "View view = new View(); " +
1683 "view.PivotPoint = PivotPoint.Center; " +
1684 "view.PositionUsesPivotPoint = true;")]
1685 [EditorBrowsable(EditorBrowsableState.Never)]
1686 public Position AnchorPoint
1690 Position temp = new Position(0.0f, 0.0f, 0.0f);
1691 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1692 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1696 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1697 NotifyPropertyChanged();
1702 /// Sets the size of a view for the width, the height and the depth.<br />
1703 /// Geometry can be scaled to fit within this area.<br />
1704 /// This does not interfere with the view's scale factor.<br />
1705 /// The views default depth is the minimum of width and height.<br />
1709 /// Animatable - This property can be animated using <c>Animation</c> class.
1711 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1713 /// <since_tizen> 5 </since_tizen>
1718 Size tmp = (Size)GetValue(SizeProperty);
1719 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1723 SetValue(SizeProperty, value);
1724 // Set Specification so when layouts measure this View it matches the value set here.
1725 // All Views are currently Layouts.
1726 WidthSpecification = (int)Math.Ceiling(value.Width);
1727 HeightSpecification = (int)Math.Ceiling(value.Height);
1728 NotifyPropertyChanged();
1733 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1735 /// <since_tizen> 3 </since_tizen>
1736 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1738 "Container parent = view.GetParent(); " +
1739 "View view = parent as View;")]
1740 [EditorBrowsable(EditorBrowsableState.Never)]
1741 public new View Parent
1746 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1747 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1748 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1750 if (basehandle is Layer layer)
1752 ret = new View(Layer.getCPtr(layer).Handle, false);
1753 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1757 ret = basehandle as View;
1760 Interop.BaseHandle.delete_BaseHandle(CPtr);
1761 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1763 if (NDalicPINVOKE.SWIGPendingException.Pending)
1764 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1770 /// Gets/Sets whether inherit parent's the layout Direction.
1772 /// <since_tizen> 4 </since_tizen>
1773 public bool InheritLayoutDirection
1777 return (bool)GetValue(InheritLayoutDirectionProperty);
1781 SetValue(InheritLayoutDirectionProperty, value);
1782 NotifyPropertyChanged();
1787 /// Gets/Sets the layout Direction.
1789 /// <since_tizen> 4 </since_tizen>
1790 public ViewLayoutDirectionType LayoutDirection
1794 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1798 SetValue(LayoutDirectionProperty, value);
1799 NotifyPropertyChanged();
1800 _layout?.RequestLayout();
1805 /// Gets or sets the Margin for use in layout.
1808 /// Margin property is supported by Layout algorithms and containers.
1809 /// Please Set Layout if you want to use Margin property.
1810 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1812 /// <since_tizen> 4 </since_tizen>
1813 public Extents Margin
1817 // If View has a Layout then margin is stored in Layout.
1820 return Layout.Margin;
1824 // If Layout not set then return margin stored in View.
1825 Extents temp = (Extents)GetValue(MarginProperty);
1826 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1828 // Two return points to prevent creating a zeroed Extent native object before assignment
1834 // Layout set so store Margin in LayoutItem instead of View.
1835 // If View stores the Margin too then the Legacy Size Negotiation will
1836 // overwrite the position and size values measured in the Layouting.
1837 Layout.Margin = value;
1838 SetValue(MarginProperty, new Extents(0,0,0,0));
1839 _layout?.RequestLayout();
1843 SetValue(MarginProperty, value);
1845 NotifyPropertyChanged();
1846 _layout?.RequestLayout();
1851 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1853 /// <since_tizen> 6 </since_tizen>
1854 public int WidthSpecification
1858 return _widthPolicy;
1862 _widthPolicy = value;
1863 if (_widthPolicy >= 0)
1865 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1867 if(_heightPolicy>=0) // Policy an exact value
1869 Size2D.Width = _widthPolicy;
1873 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1874 // Size2D height will store the specification value (negative number) this will then be applied to the
1875 // HeightSpecification when the Size2D callback is invoked.
1876 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1879 _layout?.RequestLayout();
1884 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1886 /// <since_tizen> 6 </since_tizen>
1887 public int HeightSpecification
1891 return _heightPolicy;
1895 _heightPolicy = value;
1896 if (_heightPolicy >= 0)
1898 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1900 if(_widthPolicy>=0) // Policy an exact value
1902 Size2D.Height = _heightPolicy;
1906 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1907 // Size2D height will store the specification value (negative number) this will then be applied to the
1908 // HeightSpecification when the Size2D callback is invoked.
1909 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1913 _layout?.RequestLayout();
1918 /// Gets the List of transitions for this View.
1920 /// <since_tizen> 6 </since_tizen>
1921 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
1925 if (_layoutTransitions == null)
1927 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1929 return _layoutTransitions;
1934 /// Set a layout transitions for this View.
1937 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
1939 /// <since_tizen> 6 </since_tizen>
1940 public LayoutTransition LayoutTransition
1944 if (_layoutTransitions == null)
1946 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1948 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
1950 AttachTransitionsToChildren(value);
1955 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
1958 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1960 /// <since_tizen> 4 </since_tizen>
1961 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
1962 [EditorBrowsable(EditorBrowsableState.Never)]
1963 public Extents PaddingEX
1967 Extents temp = new Extents(0, 0, 0, 0);
1968 GetProperty(View.Property.PADDING).Get(temp);
1969 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1973 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
1974 NotifyPropertyChanged();
1975 _layout?.RequestLayout();
1979 /// <since_tizen> 6 </since_tizen>
1980 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1981 [EditorBrowsable(EditorBrowsableState.Never)]
1982 public Style XamlStyle
1986 return (Style)GetValue(XamlStyleProperty);
1990 SetValue(XamlStyleProperty, value);
1995 /// The Color of View. This is an RGBA value.
1999 /// Animatable - This property can be animated using <c>Animation</c> class.
2001 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2003 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2004 [EditorBrowsable(EditorBrowsableState.Never)]
2009 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
2010 GetProperty(Interop.ActorProperty.Actor_Property_COLOR_get()).Get(temp);
2011 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2020 /// Set the layout on this View. Replaces any existing Layout.
2022 /// <since_tizen> 6 </since_tizen>
2023 public LayoutItem Layout
2031 // Do nothing if layout provided is already set on this View.
2032 if (value == _layout)
2037 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2038 layoutingDisabled = false;
2041 // If new layout being set already has a owner then that owner receives a replacement default layout.
2042 // First check if the layout to be set already has a owner.
2043 if (value?.Owner != null)
2045 // Previous owner of the layout gets a default layout as a replacement.
2046 value.Owner.Layout = new LayoutGroup();
2048 // Copy Margin and Padding to replacement LayoutGroup.
2049 value.Owner.Layout.Margin = value.Margin;
2050 value.Owner.Layout.Padding = value.Padding;
2053 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2054 // View if no replacement. Previously margin and padding values would have been moved from
2055 // the View to the layout.
2056 if (_layout != null ) // Existing layout
2060 // Existing layout being replaced so copy over margin and padding values.
2061 value.Margin = _layout.Margin;
2062 value.Padding = _layout.Padding;
2066 // Layout not being replaced so restore margin and padding to View.
2067 SetValue(MarginProperty, _layout.Margin);
2068 SetValue(PaddingProperty, _layout.Padding);
2069 NotifyPropertyChanged();
2074 // First Layout to be added to the View hence copy
2076 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2079 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2081 // If View already has a margin set then store it in Layout instead.
2082 value.Margin = Margin;
2083 SetValue(MarginProperty, new Extents(0,0,0,0));
2084 NotifyPropertyChanged();
2087 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2089 // If View already has a padding set then store it in Layout instead.
2090 value.Padding = Padding;
2091 SetValue(PaddingProperty, new Extents(0,0,0,0));
2092 NotifyPropertyChanged();
2097 // Remove existing layout from it's parent layout group.
2098 _layout?.Unparent();
2100 // Set layout to this view
2106 /// The weight of the View, used to share available space in a layout with siblings.
2108 /// <since_tizen> 6 </since_tizen>
2118 _layout?.RequestLayout();
2123 /// Whether to load the BackgroundImage synchronously.
2124 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2125 /// Note: For Normal Quad images only.
2127 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2128 [EditorBrowsable(EditorBrowsableState.Never)]
2129 public bool BackgroundImageSynchronosLoading
2133 return _backgroundImageSynchronosLoading;
2137 _backgroundImageSynchronosLoading = value;
2140 Background.Find(Visual.Property.Type)?.Get(out visualType);
2141 if (visualType == (int)Visual.Type.Image)
2143 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2146 if (bgUrl.Length != 0)
2148 PropertyMap bgMap = this.Background;
2149 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2155 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2156 [EditorBrowsable(EditorBrowsableState.Never)]
2157 public Vector2 UpdateSizeHint
2161 return (Vector2)GetValue(UpdateSizeHintProperty);
2165 SetValue(UpdateSizeHintProperty, value);
2166 NotifyPropertyChanged();
2170 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2171 [EditorBrowsable(EditorBrowsableState.Never)]
2172 public string[] TransitionNames
2176 return transitionNames;
2180 transitionNames = value;
2186 /// Get Style, it is abstract function and must be override.
2188 /// <since_tizen> 6 </since_tizen>
2189 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2190 [EditorBrowsable(EditorBrowsableState.Never)]
2191 protected virtual ViewStyle GetViewStyle()
2193 viewStyle = new ViewStyle();
2197 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2198 [EditorBrowsable(EditorBrowsableState.Never)]
2199 protected virtual bool OnControlStateChanged(ControlStates currentState)
2201 //If need to apply the state to all child, return true;
2204 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2206 var view = (View)bindable;
2207 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2209 defaultValueCreator: (bindable) =>
2211 var view = (View)bindable;
2212 return view.backgroundImageSelector;
2214 private TriggerableSelector<string> _backgroundImageSelector;
2215 private TriggerableSelector<string> backgroundImageSelector
2219 if (null == _backgroundImageSelector)
2221 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2223 return _backgroundImageSelector;
2226 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2228 var view = (View)bindable;
2229 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2231 defaultValueCreator: (bindable) =>
2233 var view = (View)bindable;
2234 return view.backgroundColorSelector;
2236 private TriggerableSelector<Color> _backgroundColorSelector;
2237 private TriggerableSelector<Color> backgroundColorSelector
2241 if (null == _backgroundColorSelector)
2243 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2245 return _backgroundColorSelector;
2248 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2250 var view = (View)bindable;
2251 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2253 defaultValueCreator: (bindable) =>
2255 var view = (View)bindable;
2256 return view.backgroundImageBorderSelector;
2258 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2259 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2263 if (null == _backgroundImageBorderSelector)
2265 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2267 return _backgroundImageBorderSelector;
2270 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2272 var view = (View)bindable;
2273 view.opacitySelector.Clone((Selector<float?>)newValue);
2275 defaultValueCreator: (bindable) =>
2277 var view = (View)bindable;
2278 return view.opacitySelector;
2280 private TriggerableSelector<float?> _opacitySelector;
2281 private TriggerableSelector<float?> opacitySelector
2285 if (null == _opacitySelector)
2287 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2289 return _opacitySelector;
2293 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2294 [EditorBrowsable(EditorBrowsableState.Never)]
2295 public virtual void ApplyStyle(ViewStyle viewStyle)
2297 if (null == viewStyle)
2302 if (this.viewStyle == viewStyle)
2307 if (null != this.viewStyle)
2309 simpleBinding.Clear();
2312 this.viewStyle = viewStyle;
2314 Dictionary<string, BindableProperty> bindablePropertyOfView;
2315 Type viewType = GetType();
2317 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2318 Type styleType = viewStyle.GetType();
2320 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2321 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2323 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2325 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2327 BindableProperty viewProperty;
2328 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2330 if (null != viewProperty)
2332 object value = viewStyle.GetValue(keyValuePair.Value);
2336 SetValue(viewProperty, value);
2339 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2345 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2346 [EditorBrowsable(EditorBrowsableState.Never)]
2347 private BundledPipe simpleBinding = new BundledPipe();