2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
33 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
35 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public bool layoutSet = false;
40 /// Flag to allow Layouting to be disabled for Views.
41 /// Once a View has a Layout set then any children added to Views from then on will receive
42 /// automatic Layouts.
44 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public static bool layoutingDisabled{get; set;} = true;
48 private LayoutItem _layout; // Exclusive layout assigned to this View.
50 // List of transitions paired with the condition that uses the transition.
51 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54 private int _oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later
55 private int _oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later
56 private float _weight = 0.0f; // Weighting of child View in a Layout
57 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
58 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
59 private bool _backgroundImageSynchronosLoading = false;
60 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
61 private string[] transitionNames;
62 private bool controlStatePropagation = false;
64 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
65 internal BackgroundExtraData backgroundExtraData;
70 /// The Style instance binded with this View.
72 private ViewStyle viewStyle;
74 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
75 [EditorBrowsable(EditorBrowsableState.Never)]
76 public ViewStyle ViewStyle
80 if (null == viewStyle)
82 ApplyStyle(GetViewStyle());
90 /// Creates a new instance of a view.
92 /// <since_tizen> 3 </since_tizen>
93 public View() : this(Interop.View.View_New(), true)
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
99 [EditorBrowsable(EditorBrowsableState.Never)]
100 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
102 this.ViewStyle.CopyFrom(viewStyle);
106 /// Create a new instance of a View with setting the status of shown or hidden.
108 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
109 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
110 [EditorBrowsable(EditorBrowsableState.Never)]
111 public View(bool shown) : this(Interop.View.View_New(), true)
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
128 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
130 if (this.viewStyle == null)
132 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
136 this.viewStyle.CopyFrom(viewStyle);
140 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
144 PositionUsesPivotPoint = false;
147 _onWindowSendEventCallback = SendViewAddedEventToWindow;
148 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
156 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
158 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 /// The event that is triggered when the View's ControlState is changed.
169 [EditorBrowsable(EditorBrowsableState.Never)]
170 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
172 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
174 private ControlState controlStates = ControlState.Normal;
176 /// Get/Set the control state.
178 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
179 [EditorBrowsable(EditorBrowsableState.Never)]
180 public ControlState ControlState
184 return controlStates;
188 if (controlStates == value)
193 var prevState = controlStates;
195 controlStates = value;
197 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
199 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
201 OnControlStateChanged(changeInfo);
203 if (controlStatePropagation)
205 foreach (View child in Children)
207 child.ControlState = value;
211 ControlStateChangedEvent?.Invoke(this, changeInfo);
215 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
216 [EditorBrowsable(EditorBrowsableState.Never)]
217 public bool IsResourcesCreated
221 return Application.Current.IsResourcesCreated;
225 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
226 [EditorBrowsable(EditorBrowsableState.Never)]
227 public ResourceDictionary XamlResources
231 return Application.Current.XamlResources;
235 Application.Current.XamlResources = value;
240 /// The StyleName, type string.
242 /// <since_tizen> 3 </since_tizen>
243 public string StyleName
247 return (string)GetValue(StyleNameProperty);
251 SetValue(StyleNameProperty, value);
252 NotifyPropertyChanged();
257 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
260 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
262 /// <since_tizen> 3 </since_tizen>
263 public Color BackgroundColor
267 Color temp = (Color)GetValue(BackgroundColorProperty);
268 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
272 if (viewStyle != null)
274 viewStyle.BackgroundImage = null;
275 viewStyle.BackgroundColor = value;
279 SetValue(BackgroundColorProperty, value);
282 NotifyPropertyChanged();
287 /// The mutually exclusive with "backgroundColor" and "background" type Map.
289 /// <since_tizen> 3 </since_tizen>
290 public string BackgroundImage
294 return (string)GetValue(BackgroundImageProperty);
298 if (viewStyle != null)
300 viewStyle.BackgroundColor = null;
301 viewStyle.BackgroundImage = value;
305 SetValue(BackgroundImageProperty, value);
308 NotifyPropertyChanged();
313 /// Get or set the border of background image.
315 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
316 [EditorBrowsable(EditorBrowsableState.Never)]
317 public Rectangle BackgroundImageBorder
321 return (Rectangle)GetValue(BackgroundImageBorderProperty);
325 if (viewStyle != null)
327 viewStyle.BackgroundImageBorder = value;
331 SetValue(BackgroundImageBorderProperty, value);
334 NotifyPropertyChanged();
339 /// The background of view.
341 /// <since_tizen> 3 </since_tizen>
342 public Tizen.NUI.PropertyMap Background
346 return (PropertyMap)GetValue(BackgroundProperty);
350 SetValue(BackgroundProperty, value);
351 NotifyPropertyChanged();
356 /// Describes a shadow as an image for a View.
357 /// It is null by default.
360 /// Gettter returns copied instance of current shadow.
363 /// The mutually exclusive with "BoxShadow".
365 [EditorBrowsable(EditorBrowsableState.Never)]
366 public ImageShadow ImageShadow
370 return (ImageShadow)GetValue(ImageShadowProperty);
374 SetValue(ImageShadowProperty, value);
375 NotifyPropertyChanged();
380 /// Describes a box shaped shadow drawing for a View.
381 /// It is null by default.
384 /// Gettter returns copied instance of current shadow.
387 /// The mutually exclusive with "ImageShadow".
389 [EditorBrowsable(EditorBrowsableState.Never)]
390 public Shadow BoxShadow
394 return (Shadow)GetValue(BoxShadowProperty);
398 SetValue(BoxShadowProperty, value);
399 NotifyPropertyChanged();
404 /// The radius for the rounded corners of the View.
405 /// This will rounds background and shadow edges.
406 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
408 [EditorBrowsable(EditorBrowsableState.Never)]
409 public float CornerRadius
413 return (float)GetValue(CornerRadiusProperty);
417 SetValue(CornerRadiusProperty, value);
418 NotifyPropertyChanged();
423 /// The current state of the view.
425 /// <since_tizen> 3 </since_tizen>
430 return (States)GetValue(StateProperty);
434 SetValue(StateProperty, value);
435 NotifyPropertyChanged();
440 /// The current sub state of the view.
442 /// <since_tizen> 3 </since_tizen>
443 public States SubState
447 return (States)GetValue(SubStateProperty);
451 SetValue(SubStateProperty, value);
452 NotifyPropertyChanged();
457 /// Displays a tooltip
459 /// <since_tizen> 3 </since_tizen>
460 public Tizen.NUI.PropertyMap Tooltip
464 return (PropertyMap)GetValue(TooltipProperty);
468 SetValue(TooltipProperty, value);
469 NotifyPropertyChanged();
474 /// Displays a tooltip as a text.
476 /// <since_tizen> 3 </since_tizen>
477 public string TooltipText
481 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
482 NotifyPropertyChanged();
487 /// The Child property of FlexContainer.<br />
488 /// The proportion of the free space in the container, the flex item will receive.<br />
489 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
491 /// <since_tizen> 3 </since_tizen>
492 [Obsolete("Deprecated in API8, will be removed in API10.")]
497 return (float)GetValue(FlexProperty);
501 SetValue(FlexProperty, value);
502 NotifyPropertyChanged();
507 /// The Child property of FlexContainer.<br />
508 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
510 /// <since_tizen> 3 </since_tizen>
511 [Obsolete("Deprecated in API8, will be removed in API10.")]
516 return (int)GetValue(AlignSelfProperty);
520 SetValue(AlignSelfProperty, value);
521 NotifyPropertyChanged();
526 /// The Child property of FlexContainer.<br />
527 /// The space around the flex item.<br />
530 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
532 /// <since_tizen> 3 </since_tizen>
533 [Obsolete("Deprecated in API8, will be removed in API10.")]
534 public Vector4 FlexMargin
538 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
539 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
543 SetValue(FlexMarginProperty, value);
544 NotifyPropertyChanged();
549 /// The top-left cell this child occupies, if not set, the first available cell is used.
552 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
554 /// <since_tizen> 3 </since_tizen>
555 public Vector2 CellIndex
559 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
560 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
564 SetValue(CellIndexProperty, value);
565 NotifyPropertyChanged();
570 /// The number of rows this child occupies, if not set, the default value is 1.
572 /// <since_tizen> 3 </since_tizen>
577 return (float)GetValue(RowSpanProperty);
581 SetValue(RowSpanProperty, value);
582 NotifyPropertyChanged();
587 /// The number of columns this child occupies, if not set, the default value is 1.
589 /// <since_tizen> 3 </since_tizen>
590 public float ColumnSpan
594 return (float)GetValue(ColumnSpanProperty);
598 SetValue(ColumnSpanProperty, value);
599 NotifyPropertyChanged();
604 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
606 /// <since_tizen> 3 </since_tizen>
607 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
611 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
615 SetValue(CellHorizontalAlignmentProperty, value);
616 NotifyPropertyChanged();
621 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
623 /// <since_tizen> 3 </since_tizen>
624 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
628 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
632 SetValue(CellVerticalAlignmentProperty, value);
633 NotifyPropertyChanged();
638 /// The left focusable view.<br />
639 /// This will return null if not set.<br />
640 /// This will also return null if the specified left focusable view is not on a window.<br />
642 /// <since_tizen> 3 </since_tizen>
643 public View LeftFocusableView
645 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
648 return (View)GetValue(LeftFocusableViewProperty);
652 SetValue(LeftFocusableViewProperty, value);
653 NotifyPropertyChanged();
658 /// The right focusable view.<br />
659 /// This will return null if not set.<br />
660 /// This will also return null if the specified right focusable view is not on a window.<br />
662 /// <since_tizen> 3 </since_tizen>
663 public View RightFocusableView
665 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
668 return (View)GetValue(RightFocusableViewProperty);
672 SetValue(RightFocusableViewProperty, value);
673 NotifyPropertyChanged();
678 /// The up focusable view.<br />
679 /// This will return null if not set.<br />
680 /// This will also return null if the specified up focusable view is not on a window.<br />
682 /// <since_tizen> 3 </since_tizen>
683 public View UpFocusableView
685 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
688 return (View)GetValue(UpFocusableViewProperty);
692 SetValue(UpFocusableViewProperty, value);
693 NotifyPropertyChanged();
698 /// The down focusable view.<br />
699 /// This will return null if not set.<br />
700 /// This will also return null if the specified down focusable view is not on a window.<br />
702 /// <since_tizen> 3 </since_tizen>
703 public View DownFocusableView
705 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
708 return (View)GetValue(DownFocusableViewProperty);
712 SetValue(DownFocusableViewProperty, value);
713 NotifyPropertyChanged();
718 /// Whether the view should be focusable by keyboard navigation.
720 /// <since_tizen> 3 </since_tizen>
721 public bool Focusable
725 SetValue(FocusableProperty, value);
726 NotifyPropertyChanged();
730 return (bool)GetValue(FocusableProperty);
735 /// Retrieves the position of the view.<br />
736 /// The coordinates are relative to the view's parent.<br />
738 /// <since_tizen> 3 </since_tizen>
739 public Position CurrentPosition
743 return GetCurrentPosition();
748 /// Sets the size of a view for the width and the height.<br />
749 /// Geometry can be scaled to fit within this area.<br />
750 /// This does not interfere with the view's scale factor.<br />
751 /// The views default depth is the minimum of width and height.<br />
754 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
755 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
757 /// <since_tizen> 3 </since_tizen>
762 Size2D temp = (Size2D)GetValue(Size2DProperty);
763 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
767 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
768 SetValue(Size2DProperty, value);
769 // Set Specification so when layouts measure this View it matches the value set here.
770 // All Views are currently Layouts.
771 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
772 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
773 _widthPolicy = value.Width;
774 _heightPolicy = value.Height;
775 _layout?.RequestLayout();
776 NotifyPropertyChanged();
781 /// Retrieves the size of the view.<br />
782 /// The coordinates are relative to the view's parent.<br />
784 /// <since_tizen> 3 </since_tizen>
785 public Size2D CurrentSize
789 return GetCurrentSize();
794 /// Retrieves and sets the view's opacity.<br />
796 /// <since_tizen> 3 </since_tizen>
801 return (float)GetValue(OpacityProperty);
805 if (viewStyle != null)
807 viewStyle.Opacity = value;
811 SetValue(OpacityProperty, value);
814 NotifyPropertyChanged();
819 /// Sets the position of the view for X and Y.<br />
820 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
821 /// If the position inheritance is disabled, sets the world position.<br />
824 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
825 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
827 /// <since_tizen> 3 </since_tizen>
828 public Position2D Position2D
832 Position2D temp = (Position2D)GetValue(Position2DProperty);
833 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
837 SetValue(Position2DProperty, value);
838 NotifyPropertyChanged();
843 /// Retrieves the screen postion of the view.<br />
845 /// <since_tizen> 3 </since_tizen>
846 public Vector2 ScreenPosition
850 Vector2 temp = new Vector2(0.0f, 0.0f);
851 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
857 /// Determines whether the pivot point should be used to determine the position of the view.
858 /// This is false by default.
860 /// <remarks>If false, then the top-left of the view is used for the position.
861 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
863 /// <since_tizen> 3 </since_tizen>
864 public bool PositionUsesPivotPoint
868 return (bool)GetValue(PositionUsesPivotPointProperty);
872 SetValue(PositionUsesPivotPointProperty, value);
873 NotifyPropertyChanged();
878 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
880 /// <since_tizen> 3 </since_tizen>
881 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
883 "View view = new View(); " +
884 "view.PivotPoint = PivotPoint.Center; " +
885 "view.PositionUsesPivotPoint = true;" +
886 " Deprecated in API5: Will be removed in API8")]
887 [EditorBrowsable(EditorBrowsableState.Never)]
888 public bool PositionUsesAnchorPoint
893 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
898 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
899 NotifyPropertyChanged();
904 /// Queries whether the view is connected to the stage.<br />
905 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
907 /// <since_tizen> 3 </since_tizen>
908 public bool IsOnWindow
917 /// Gets the depth in the hierarchy for the view.
919 /// <since_tizen> 3 </since_tizen>
920 public int HierarchyDepth
924 return GetHierarchyDepth();
929 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
932 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
933 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
934 /// The values set by this property will likely change.
936 /// <since_tizen> 3 </since_tizen>
937 public int SiblingOrder
941 return (int)GetValue(SiblingOrderProperty);
945 SetValue(SiblingOrderProperty, value);
947 LayoutGroup layout = Layout as LayoutGroup;
948 layout?.ChangeLayoutSiblingOrder(value);
950 NotifyPropertyChanged();
955 /// Returns the natural size of the view.
958 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
960 /// <since_tizen> 5 </since_tizen>
961 public Vector3 NaturalSize
965 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
966 if (NDalicPINVOKE.SWIGPendingException.Pending)
967 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
973 /// Returns the natural size (Size2D) of the view.
976 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
978 /// <since_tizen> 4 </since_tizen>
979 public Size2D NaturalSize2D
983 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
984 if (NDalicPINVOKE.SWIGPendingException.Pending)
985 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
987 return new Size2D((int)temp.Width, (int)temp.Height);
992 /// Gets or sets the origin of a view within its parent's area.<br />
993 /// 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 />
994 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
995 /// A view's position is the distance between this origin and the view's anchor-point.<br />
997 /// <pre>The view has been initialized.</pre>
998 /// <since_tizen> 3 </since_tizen>
999 public Position ParentOrigin
1003 Position tmp = (Position)GetValue(ParentOriginProperty);
1004 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1008 SetValue(ParentOriginProperty, value);
1009 NotifyPropertyChanged();
1014 /// Gets or sets the anchor-point of a view.<br />
1015 /// 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 />
1016 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1017 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1018 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1019 /// <pre>The view has been initialized.</pre>
1022 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1024 /// <since_tizen> 3 </since_tizen>
1025 public Position PivotPoint
1029 Position tmp = (Position)GetValue(PivotPointProperty);
1030 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1034 SetValue(PivotPointProperty, value);
1035 NotifyPropertyChanged();
1040 /// Gets or sets the size width of the view.
1044 /// Animatable - This property can be animated using <c>Animation</c> class.
1047 /// <since_tizen> 3 </since_tizen>
1048 public float SizeWidth
1052 return (float)GetValue(SizeWidthProperty);
1056 SetValue(SizeWidthProperty, value);
1057 NotifyPropertyChanged();
1062 /// Gets or sets the size height of the view.
1066 /// Animatable - This property can be animated using <c>Animation</c> class.
1069 /// <since_tizen> 3 </since_tizen>
1070 public float SizeHeight
1074 return (float)GetValue(SizeHeightProperty);
1078 SetValue(SizeHeightProperty, value);
1079 NotifyPropertyChanged();
1084 /// Gets or sets the position of the view.<br />
1085 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1086 /// If the position inheritance is disabled, sets the world position.<br />
1090 /// Animatable - This property can be animated using <c>Animation</c> class.
1092 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1094 /// <since_tizen> 3 </since_tizen>
1095 public Position Position
1099 Position tmp = (Position)GetValue(PositionProperty);
1100 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1104 SetValue(PositionProperty, value);
1105 NotifyPropertyChanged();
1110 /// Gets or sets the position X of the view.
1114 /// Animatable - This property can be animated using <c>Animation</c> class.
1117 /// <since_tizen> 3 </since_tizen>
1118 public float PositionX
1122 return (float)GetValue(PositionXProperty);
1126 SetValue(PositionXProperty, value);
1127 NotifyPropertyChanged();
1132 /// Gets or sets the position Y of the view.
1136 /// Animatable - This property can be animated using <c>Animation</c> class.
1139 /// <since_tizen> 3 </since_tizen>
1140 public float PositionY
1144 return (float)GetValue(PositionYProperty);
1148 SetValue(PositionYProperty, value);
1149 NotifyPropertyChanged();
1154 /// Gets or sets the position Z of the view.
1158 /// Animatable - This property can be animated using <c>Animation</c> class.
1161 /// <since_tizen> 3 </since_tizen>
1162 public float PositionZ
1166 return (float)GetValue(PositionZProperty);
1170 SetValue(PositionZProperty, value);
1171 NotifyPropertyChanged();
1176 /// Gets or sets the world position of the view.
1178 /// <since_tizen> 3 </since_tizen>
1179 public Vector3 WorldPosition
1183 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1184 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1190 /// Gets or sets the orientation of the view.<br />
1191 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1195 /// This is an asynchronous method.
1198 /// Animatable - This property can be animated using <c>Animation</c> class.
1201 /// <since_tizen> 3 </since_tizen>
1202 public Rotation Orientation
1206 return (Rotation)GetValue(OrientationProperty);
1210 SetValue(OrientationProperty, value);
1211 NotifyPropertyChanged();
1216 /// Gets or sets the world orientation of the view.<br />
1218 /// <since_tizen> 3 </since_tizen>
1219 public Rotation WorldOrientation
1223 Rotation temp = new Rotation();
1224 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1230 /// Gets or sets the scale factor applied to the view.<br />
1234 /// Animatable - This property can be animated using <c>Animation</c> class.
1236 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1238 /// <since_tizen> 3 </since_tizen>
1239 public Vector3 Scale
1243 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1244 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1248 SetValue(ScaleProperty, value);
1249 NotifyPropertyChanged();
1254 /// Gets or sets the scale X factor applied to the view.
1258 /// Animatable - This property can be animated using <c>Animation</c> class.
1261 /// <since_tizen> 3 </since_tizen>
1266 return (float)GetValue(ScaleXProperty);
1270 SetValue(ScaleXProperty, value);
1271 NotifyPropertyChanged();
1276 /// Gets or sets the scale Y factor applied to the view.
1280 /// Animatable - This property can be animated using <c>Animation</c> class.
1283 /// <since_tizen> 3 </since_tizen>
1288 return (float)GetValue(ScaleYProperty);
1292 SetValue(ScaleYProperty, value);
1293 NotifyPropertyChanged();
1298 /// Gets or sets the scale Z factor applied to the view.
1302 /// Animatable - This property can be animated using <c>Animation</c> class.
1305 /// <since_tizen> 3 </since_tizen>
1310 return (float)GetValue(ScaleZProperty);
1314 SetValue(ScaleZProperty, value);
1315 NotifyPropertyChanged();
1320 /// Gets the world scale of the view.
1322 /// <since_tizen> 3 </since_tizen>
1323 public Vector3 WorldScale
1327 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1328 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1334 /// Retrieves the visibility flag of the view.
1338 /// If the view is not visible, then the view and its children will not be rendered.
1339 /// 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.
1342 /// Animatable - This property can be animated using <c>Animation</c> class.
1345 /// <since_tizen> 3 </since_tizen>
1346 public bool Visibility
1351 GetProperty(View.Property.VISIBLE).Get(out temp);
1357 /// Gets the view's world color.
1359 /// <since_tizen> 3 </since_tizen>
1360 public Vector4 WorldColor
1364 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1365 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1371 /// Gets or sets the view's name.
1373 /// <since_tizen> 3 </since_tizen>
1378 return (string)GetValue(NameProperty);
1382 SetValue(NameProperty, value);
1383 NotifyPropertyChanged();
1388 /// Get the number of children held by the view.
1390 /// <since_tizen> 3 </since_tizen>
1391 public new uint ChildCount
1395 return GetChildCount();
1400 /// Gets the view's ID.
1403 /// <since_tizen> 3 </since_tizen>
1413 /// Gets or sets the status of whether the view should emit touch or hover signals.
1415 /// <since_tizen> 3 </since_tizen>
1416 public bool Sensitive
1420 return (bool)GetValue(SensitiveProperty);
1424 SetValue(SensitiveProperty, value);
1425 NotifyPropertyChanged();
1430 /// 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.
1432 /// <since_tizen> 3 </since_tizen>
1433 public bool LeaveRequired
1437 return (bool)GetValue(LeaveRequiredProperty);
1441 SetValue(LeaveRequiredProperty, value);
1442 NotifyPropertyChanged();
1447 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1449 /// <since_tizen> 3 </since_tizen>
1450 public bool InheritOrientation
1454 return (bool)GetValue(InheritOrientationProperty);
1458 SetValue(InheritOrientationProperty, value);
1459 NotifyPropertyChanged();
1464 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1466 /// <since_tizen> 3 </since_tizen>
1467 public bool InheritScale
1471 return (bool)GetValue(InheritScaleProperty);
1475 SetValue(InheritScaleProperty, value);
1476 NotifyPropertyChanged();
1481 /// Gets or sets the status of how the view and its children should be drawn.<br />
1482 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1483 /// 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 />
1484 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1485 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1486 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1488 /// <since_tizen> 3 </since_tizen>
1489 public DrawModeType DrawMode
1493 return (DrawModeType)GetValue(DrawModeProperty);
1497 SetValue(DrawModeProperty, value);
1498 NotifyPropertyChanged();
1503 /// Gets or sets the relative to parent size factor of the view.<br />
1504 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1505 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1508 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1510 /// <since_tizen> 3 </since_tizen>
1511 public Vector3 SizeModeFactor
1515 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1516 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1520 SetValue(SizeModeFactorProperty, value);
1521 NotifyPropertyChanged();
1526 /// Gets or sets the width resize policy to be used.
1528 /// <since_tizen> 3 </since_tizen>
1529 public ResizePolicyType WidthResizePolicy
1533 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1537 SetValue(WidthResizePolicyProperty, value);
1538 NotifyPropertyChanged();
1543 /// Gets or sets the height resize policy to be used.
1545 /// <since_tizen> 3 </since_tizen>
1546 public ResizePolicyType HeightResizePolicy
1550 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1554 SetValue(HeightResizePolicyProperty, value);
1555 NotifyPropertyChanged();
1560 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1561 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1563 /// <since_tizen> 3 </since_tizen>
1564 public SizeScalePolicyType SizeScalePolicy
1568 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1572 SetValue(SizeScalePolicyProperty, value);
1573 NotifyPropertyChanged();
1578 /// Gets or sets the status of whether the width size is dependent on the height size.
1580 /// <since_tizen> 3 </since_tizen>
1581 public bool WidthForHeight
1585 return (bool)GetValue(WidthForHeightProperty);
1589 SetValue(WidthForHeightProperty, value);
1590 NotifyPropertyChanged();
1595 /// Gets or sets the status of whether the height size is dependent on the width size.
1597 /// <since_tizen> 3 </since_tizen>
1598 public bool HeightForWidth
1602 return (bool)GetValue(HeightForWidthProperty);
1606 SetValue(HeightForWidthProperty, value);
1607 NotifyPropertyChanged();
1612 /// Gets or sets the padding for use in layout.
1615 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1617 /// <since_tizen> 5 </since_tizen>
1618 public Extents Padding
1622 // If View has a Layout then padding in stored in the base Layout class
1625 return Layout.Padding;
1629 Extents temp = (Extents)GetValue(PaddingProperty);
1630 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1632 // Two return points to prevent creating a zeroed Extent native object before assignment
1636 Extents padding = value;
1639 // Layout set so store Padding in LayoutItem instead of in View.
1640 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1641 // the position and sizes measure in the Layouting.
1642 Layout.Padding = value;
1643 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1644 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1645 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1647 padding = new Extents(0,0,0,0); // Reset value stored in View.
1649 _layout?.RequestLayout();
1651 SetValue(PaddingProperty, padding);
1652 NotifyPropertyChanged();
1653 _layout?.RequestLayout();
1658 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1661 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1663 /// <since_tizen> 3 </since_tizen>
1664 public Size2D MinimumSize
1668 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1669 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1673 if (_layout != null)
1675 // Note: it only works if minimum size is >= than natural size.
1676 // To force the size it should be done through the width&height spec or Size2D.
1677 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1678 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1679 _layout.RequestLayout();
1681 SetValue(MinimumSizeProperty, value);
1682 NotifyPropertyChanged();
1687 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1690 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1692 /// <since_tizen> 3 </since_tizen>
1693 public Size2D MaximumSize
1697 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1698 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1702 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1703 // MATCH_PARENT spec + parent container size can be used to limit
1704 if (_layout != null)
1706 _layout.RequestLayout();
1708 SetValue(MaximumSizeProperty, value);
1709 NotifyPropertyChanged();
1714 /// Gets or sets whether a child view inherits it's parent's position.<br />
1715 /// Default is to inherit.<br />
1716 /// 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 />
1718 /// <since_tizen> 3 </since_tizen>
1719 public bool InheritPosition
1723 return (bool)GetValue(InheritPositionProperty);
1727 SetValue(InheritPositionProperty, value);
1728 NotifyPropertyChanged();
1733 /// Gets or sets the clipping behavior (mode) of it's children.
1735 /// <since_tizen> 3 </since_tizen>
1736 public ClippingModeType ClippingMode
1740 return (ClippingModeType)GetValue(ClippingModeProperty);
1744 SetValue(ClippingModeProperty, value);
1745 NotifyPropertyChanged();
1750 /// Gets the number of renderers held by the view.
1752 /// <since_tizen> 3 </since_tizen>
1753 public uint RendererCount
1757 return GetRendererCount();
1762 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1765 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1767 /// <since_tizen> 3 </since_tizen>
1768 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1770 "View view = new View(); " +
1771 "view.PivotPoint = PivotPoint.Center; " +
1772 "view.PositionUsesPivotPoint = true;")]
1773 [EditorBrowsable(EditorBrowsableState.Never)]
1774 public Position AnchorPoint
1778 Position temp = new Position(0.0f, 0.0f, 0.0f);
1779 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1780 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1784 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1785 NotifyPropertyChanged();
1790 /// Sets the size of a view for the width, the height and the depth.<br />
1791 /// Geometry can be scaled to fit within this area.<br />
1792 /// This does not interfere with the view's scale factor.<br />
1793 /// The views default depth is the minimum of width and height.<br />
1797 /// Animatable - This property can be animated using <c>Animation</c> class.
1799 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1801 /// <since_tizen> 5 </since_tizen>
1806 Size tmp = (Size)GetValue(SizeProperty);
1807 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1811 SetValue(SizeProperty, value);
1812 NotifyPropertyChanged();
1817 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1819 /// <since_tizen> 3 </since_tizen>
1820 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1822 "Container parent = view.GetParent(); " +
1823 "View view = parent as View;")]
1824 [EditorBrowsable(EditorBrowsableState.Never)]
1825 public new View Parent
1830 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1831 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1832 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1834 if (basehandle is Layer layer)
1836 ret = new View(Layer.getCPtr(layer).Handle, false);
1837 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1841 ret = basehandle as View;
1844 Interop.BaseHandle.delete_BaseHandle(CPtr);
1845 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1847 if (NDalicPINVOKE.SWIGPendingException.Pending)
1848 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1854 /// Gets/Sets whether inherit parent's the layout Direction.
1856 /// <since_tizen> 4 </since_tizen>
1857 public bool InheritLayoutDirection
1861 return (bool)GetValue(InheritLayoutDirectionProperty);
1865 SetValue(InheritLayoutDirectionProperty, value);
1866 NotifyPropertyChanged();
1871 /// Gets/Sets the layout Direction.
1873 /// <since_tizen> 4 </since_tizen>
1874 public ViewLayoutDirectionType LayoutDirection
1878 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1882 SetValue(LayoutDirectionProperty, value);
1883 NotifyPropertyChanged();
1884 _layout?.RequestLayout();
1889 /// Gets or sets the Margin for use in layout.
1892 /// Margin property is supported by Layout algorithms and containers.
1893 /// Please Set Layout if you want to use Margin property.
1894 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1896 /// <since_tizen> 4 </since_tizen>
1897 public Extents Margin
1901 // If View has a Layout then margin is stored in Layout.
1904 return Layout.Margin;
1908 // If Layout not set then return margin stored in View.
1909 Extents temp = (Extents)GetValue(MarginProperty);
1910 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1912 // Two return points to prevent creating a zeroed Extent native object before assignment
1918 // Layout set so store Margin in LayoutItem instead of View.
1919 // If View stores the Margin too then the Legacy Size Negotiation will
1920 // overwrite the position and size values measured in the Layouting.
1921 Layout.Margin = value;
1922 SetValue(MarginProperty, new Extents(0,0,0,0));
1923 _layout?.RequestLayout();
1927 SetValue(MarginProperty, value);
1929 NotifyPropertyChanged();
1930 _layout?.RequestLayout();
1935 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1937 /// <since_tizen> 6 </since_tizen>
1938 public int WidthSpecification
1942 return _widthPolicy;
1946 _widthPolicy = value;
1947 if( _oldWidthPolicy != _widthPolicy )
1949 if (_widthPolicy >= 0)
1951 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1953 if(_heightPolicy>=0) // Policy an exact value
1955 Size2D.Width = _widthPolicy;
1959 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1960 // Size2D height will store the specification value (negative number) this will then be applied to the
1961 // HeightSpecification when the Size2D callback is invoked.
1962 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1965 _layout?.RequestLayout();
1966 _oldWidthPolicy = _widthPolicy;
1972 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1974 /// <since_tizen> 6 </since_tizen>
1975 public int HeightSpecification
1979 return _heightPolicy;
1983 _heightPolicy = value;
1984 if( _oldHeightPolicy != _heightPolicy )
1986 if (_heightPolicy >= 0)
1988 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1990 if(_widthPolicy>=0) // Policy an exact value
1992 Size2D.Height = _heightPolicy;
1996 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1997 // Size2D height will store the specification value (negative number) this will then be applied to the
1998 // HeightSpecification when the Size2D callback is invoked.
1999 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2003 _layout?.RequestLayout();
2004 _oldHeightPolicy = _heightPolicy;
2010 /// Gets the List of transitions for this View.
2012 /// <since_tizen> 6 </since_tizen>
2013 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2017 if (_layoutTransitions == null)
2019 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2021 return _layoutTransitions;
2026 /// Set a layout transitions for this View.
2029 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2031 /// <since_tizen> 6 </since_tizen>
2032 public LayoutTransition LayoutTransition
2036 if (_layoutTransitions == null)
2038 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2040 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2042 AttachTransitionsToChildren(value);
2047 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2050 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2052 /// <since_tizen> 4 </since_tizen>
2053 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2054 [EditorBrowsable(EditorBrowsableState.Never)]
2055 public Extents PaddingEX
2059 Extents temp = new Extents(0, 0, 0, 0);
2060 GetProperty(View.Property.PADDING).Get(temp);
2061 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2065 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2066 NotifyPropertyChanged();
2067 _layout?.RequestLayout();
2071 /// <since_tizen> 6 </since_tizen>
2072 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2073 [EditorBrowsable(EditorBrowsableState.Never)]
2074 public Style XamlStyle
2078 return (Style)GetValue(XamlStyleProperty);
2082 SetValue(XamlStyleProperty, value);
2087 /// The Color of View. This is an RGBA value.
2091 /// Animatable - This property can be animated using <c>Animation</c> class.
2093 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2095 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2096 [EditorBrowsable(EditorBrowsableState.Never)]
2101 Color temp = (Color)GetValue(ColorProperty);
2102 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2106 if (viewStyle != null)
2108 viewStyle.Color = value;
2112 SetValue(ColorProperty, value);
2115 NotifyPropertyChanged();
2120 /// Set the layout on this View. Replaces any existing Layout.
2122 /// <since_tizen> 6 </since_tizen>
2123 public LayoutItem Layout
2131 // Do nothing if layout provided is already set on this View.
2132 if (value == _layout)
2137 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2138 layoutingDisabled = false;
2141 // If new layout being set already has a owner then that owner receives a replacement default layout.
2142 // First check if the layout to be set already has a owner.
2143 if (value?.Owner != null)
2145 // Previous owner of the layout gets a default layout as a replacement.
2146 value.Owner.Layout = new AbsoluteLayout();
2148 // Copy Margin and Padding to replacement LayoutGroup.
2149 value.Owner.Layout.Margin = value.Margin;
2150 value.Owner.Layout.Padding = value.Padding;
2153 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2154 // View if no replacement. Previously margin and padding values would have been moved from
2155 // the View to the layout.
2156 if (_layout != null ) // Existing layout
2160 // Existing layout being replaced so copy over margin and padding values.
2161 value.Margin = _layout.Margin;
2162 value.Padding = _layout.Padding;
2166 // Layout not being replaced so restore margin and padding to View.
2167 SetValue(MarginProperty, _layout.Margin);
2168 SetValue(PaddingProperty, _layout.Padding);
2169 NotifyPropertyChanged();
2174 // First Layout to be added to the View hence copy
2176 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2179 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2181 // If View already has a margin set then store it in Layout instead.
2182 value.Margin = Margin;
2183 SetValue(MarginProperty, new Extents(0,0,0,0));
2184 NotifyPropertyChanged();
2187 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2189 // If View already has a padding set then store it in Layout instead.
2190 value.Padding = Padding;
2191 SetValue(PaddingProperty, new Extents(0,0,0,0));
2192 NotifyPropertyChanged();
2197 // Remove existing layout from it's parent layout group.
2198 _layout?.Unparent();
2200 // Set layout to this view
2206 /// The weight of the View, used to share available space in a layout with siblings.
2208 /// <since_tizen> 6 </since_tizen>
2218 _layout?.RequestLayout();
2223 /// Whether to load the BackgroundImage synchronously.
2224 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2225 /// Note: For Normal Quad images only.
2227 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2228 [EditorBrowsable(EditorBrowsableState.Never)]
2229 public bool BackgroundImageSynchronosLoading
2233 return _backgroundImageSynchronosLoading;
2237 _backgroundImageSynchronosLoading = value;
2240 Background.Find(Visual.Property.Type)?.Get(out visualType);
2241 if (visualType == (int)Visual.Type.Image)
2243 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2246 if (bgUrl.Length != 0)
2248 PropertyMap bgMap = this.Background;
2249 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2255 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2256 [EditorBrowsable(EditorBrowsableState.Never)]
2257 public Vector2 UpdateSizeHint
2261 return (Vector2)GetValue(UpdateSizeHintProperty);
2265 SetValue(UpdateSizeHintProperty, value);
2266 NotifyPropertyChanged();
2270 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2271 [EditorBrowsable(EditorBrowsableState.Never)]
2272 public string[] TransitionNames
2276 return transitionNames;
2280 transitionNames = value;
2286 /// Enable/Disable ControlState propagation for children.
2287 /// It is false by default.
2288 /// If the View needs to share ControlState with descendants, please set it true.
2289 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2291 [EditorBrowsable(EditorBrowsableState.Never)]
2292 public bool EnableControlStatePropagation
2294 get => controlStatePropagation;
2297 controlStatePropagation = value;
2299 foreach (View child in Children)
2301 child.EnableControlStatePropagation = value;
2307 /// Get Style, it is abstract function and must be override.
2309 /// <since_tizen> 6 </since_tizen>
2310 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2311 // TODO: It should be deprecated. please use CreateViewStyle instead.
2312 [EditorBrowsable(EditorBrowsableState.Never)]
2313 protected virtual ViewStyle GetViewStyle()
2315 return CreateViewStyle();
2319 /// Create Style, it is abstract function and must be override.
2321 [EditorBrowsable(EditorBrowsableState.Never)]
2322 protected virtual ViewStyle CreateViewStyle()
2324 return new ViewStyle();
2328 /// Called after the View's ControlStates changed.
2330 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2331 [EditorBrowsable(EditorBrowsableState.Never)]
2332 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2336 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2338 var view = (View)bindable;
2339 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2341 defaultValueCreator: (bindable) =>
2343 var view = (View)bindable;
2344 return view.backgroundImageSelector;
2346 private TriggerableSelector<string> _backgroundImageSelector;
2347 private TriggerableSelector<string> backgroundImageSelector
2351 if (null == _backgroundImageSelector)
2353 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2355 return _backgroundImageSelector;
2358 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2360 var view = (View)bindable;
2361 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2363 defaultValueCreator: (bindable) =>
2365 var view = (View)bindable;
2366 return view.backgroundColorSelector;
2368 private TriggerableSelector<Color> _backgroundColorSelector;
2369 private TriggerableSelector<Color> backgroundColorSelector
2373 if (null == _backgroundColorSelector)
2375 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2377 return _backgroundColorSelector;
2381 internal static readonly BindableProperty ColorSelectorProperty = BindableProperty.Create("ColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2383 var view = (View)bindable;
2384 view.colorSelector.Clone((Selector<Color>)newValue);
2386 defaultValueCreator: (bindable) =>
2388 var view = (View)bindable;
2389 return view.colorSelector;
2392 private TriggerableSelector<Color> _colorSelector;
2393 private TriggerableSelector<Color> colorSelector
2397 if (null == _colorSelector)
2399 _colorSelector = new TriggerableSelector<Color>(this, ColorProperty);
2401 return _colorSelector;
2405 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2407 var view = (View)bindable;
2408 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2410 defaultValueCreator: (bindable) =>
2412 var view = (View)bindable;
2413 return view.backgroundImageBorderSelector;
2415 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2416 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2420 if (null == _backgroundImageBorderSelector)
2422 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2424 return _backgroundImageBorderSelector;
2427 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2429 var view = (View)bindable;
2430 view.opacitySelector.Clone((Selector<float?>)newValue);
2432 defaultValueCreator: (bindable) =>
2434 var view = (View)bindable;
2435 return view.opacitySelector;
2437 private TriggerableSelector<float?> _opacitySelector;
2438 private TriggerableSelector<float?> opacitySelector
2442 if (null == _opacitySelector)
2444 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2446 return _opacitySelector;
2450 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2451 [EditorBrowsable(EditorBrowsableState.Never)]
2452 public virtual void ApplyStyle(ViewStyle viewStyle)
2454 if (null == viewStyle)
2459 if (this.viewStyle == viewStyle)
2464 if (null != this.viewStyle)
2466 simpleBinding.Clear();
2469 this.viewStyle = viewStyle;
2471 Dictionary<string, BindableProperty> bindablePropertyOfView;
2472 Type viewType = GetType();
2474 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2475 Type styleType = viewStyle.GetType();
2477 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2478 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2480 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2482 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2484 BindableProperty viewProperty;
2485 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2487 if (null != viewProperty)
2489 object value = viewStyle.GetValue(keyValuePair.Value);
2493 SetValue(viewProperty, value);
2496 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2502 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2503 [EditorBrowsable(EditorBrowsableState.Never)]
2504 private BundledPipe simpleBinding = new BundledPipe();