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 global::System.Runtime.InteropServices.HandleRef swigCPtr;
49 private LayoutItem _layout; // Exclusive layout assigned to this View.
51 // List of transitions paired with the condition that uses the transition.
52 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
53 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
54 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
55 private float _weight = 0.0f; // Weighting of child View in a Layout
56 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
57 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
58 private bool _backgroundImageSynchronosLoading = false;
59 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
60 private string[] transitionNames;
61 private Rectangle backgroundImageBorder;
63 private ImageShadow imageShadow;
65 private Shadow boxShadow;
67 private ViewStyle viewStyle;
68 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
69 [EditorBrowsable(EditorBrowsableState.Never)]
70 public ViewStyle ViewStyle
74 if (null == viewStyle)
76 ApplyStyle(GetViewStyle());
84 /// Creates a new instance of a view.
86 /// <since_tizen> 3 </since_tizen>
87 public View() : this(Interop.View.View_New(), true)
89 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
92 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
93 [EditorBrowsable(EditorBrowsableState.Never)]
94 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
96 this.ViewStyle.CopyFrom(viewStyle);
100 /// Create a new instance of a View with setting the status of shown or hidden.
102 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
103 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
104 [EditorBrowsable(EditorBrowsableState.Never)]
105 public View(bool shown) : this(Interop.View.View_New(), true)
107 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
111 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
122 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
123 this.ViewStyle.CopyFrom(viewStyle);
126 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
128 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
131 PositionUsesPivotPoint = false;
134 _onWindowSendEventCallback = SendViewAddedEventToWindow;
135 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
143 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
145 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153 internal delegate void ControlStateChangesDelegate(View obj, ControlStates state);
154 internal event ControlStateChangesDelegate ControlStateChangeEvent;
156 private ControlStates controlStates;
158 /// Get/Set the control state.
160 /// <since_tizen> 6 </since_tizen>
161 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
162 [EditorBrowsable(EditorBrowsableState.Never)]
163 public ControlStates ControlState
167 return controlStates;
171 if (controlStates != value)
173 controlStates = value;
175 ControlStateChangeEvent?.Invoke(this, value);
177 if (true == OnControlStateChanged(value))
179 foreach (View child in Children)
181 child.ControlState = value;
188 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
189 [EditorBrowsable(EditorBrowsableState.Never)]
190 public bool IsResourcesCreated
194 return Application.Current.IsResourcesCreated;
198 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
199 [EditorBrowsable(EditorBrowsableState.Never)]
200 public ResourceDictionary XamlResources
204 return Application.Current.XamlResources;
208 Application.Current.XamlResources = value;
213 /// The StyleName, type string.
215 /// <since_tizen> 3 </since_tizen>
216 public string StyleName
220 return (string)GetValue(StyleNameProperty);
224 SetValue(StyleNameProperty, value);
225 NotifyPropertyChanged();
230 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
233 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
235 /// <since_tizen> 3 </since_tizen>
236 public Color BackgroundColor
240 Color temp = (Color)GetValue(BackgroundColorProperty);
241 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
245 SetValue(BackgroundColorProperty, value);
246 NotifyPropertyChanged();
251 /// The mutually exclusive with "backgroundColor" and "background" type Map.
253 /// <since_tizen> 3 </since_tizen>
254 public string BackgroundImage
258 return (string)GetValue(BackgroundImageProperty);
262 SetValue(BackgroundImageProperty, value);
263 NotifyPropertyChanged();
268 /// Get or set the border of background image.
270 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
271 [EditorBrowsable(EditorBrowsableState.Never)]
272 public Rectangle BackgroundImageBorder
276 return (Rectangle)GetValue(BackgroundImageBorderProperty);
280 SetValue(BackgroundImageBorderProperty, value);
281 NotifyPropertyChanged();
286 /// The background of view.
288 /// <since_tizen> 3 </since_tizen>
289 public Tizen.NUI.PropertyMap Background
293 return (PropertyMap)GetValue(BackgroundProperty);
297 SetValue(BackgroundProperty, value);
298 NotifyPropertyChanged();
303 /// Describes a shadow as an image for View.
304 /// It is null by default.
307 /// The mutually exclusive with "BoxShadow".
308 /// If it is not null, the "BoxShadow" property will be ignored.
310 [EditorBrowsable(EditorBrowsableState.Never)]
311 public ImageShadow ImageShadow
315 return (ImageShadow)GetValue(ImageShadowProperty);
319 value.OnPropertyChanged = OnImageShadowChanged;
320 SetValue(ImageShadowProperty, value);
321 NotifyPropertyChanged();
326 /// Describes a box shaped shadow drawing for View.
327 /// It is null by default.
330 /// The mutually exclusive with "ImageShadow".
331 /// If the "ImageShadow" is not null, this property will be ignored.
333 [EditorBrowsable(EditorBrowsableState.Never)]
334 public Shadow BoxShadow
338 return (Shadow)GetValue(BoxShadowProperty);
342 value.OnPropertyChanged = OnBoxShadowChanged;
343 SetValue(BoxShadowProperty, value);
344 NotifyPropertyChanged();
349 /// The current state of the view.
351 /// <since_tizen> 3 </since_tizen>
356 return (States)GetValue(StateProperty);
360 SetValue(StateProperty, value);
361 NotifyPropertyChanged();
366 /// The current sub state of the view.
368 /// <since_tizen> 3 </since_tizen>
369 public States SubState
373 return (States)GetValue(SubStateProperty);
377 SetValue(SubStateProperty, value);
378 NotifyPropertyChanged();
383 /// Displays a tooltip
385 /// <since_tizen> 3 </since_tizen>
386 public Tizen.NUI.PropertyMap Tooltip
390 return (PropertyMap)GetValue(TooltipProperty);
394 SetValue(TooltipProperty, value);
395 NotifyPropertyChanged();
400 /// Displays a tooltip as a text.
402 /// <since_tizen> 3 </since_tizen>
403 public string TooltipText
407 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
408 NotifyPropertyChanged();
413 /// The Child property of FlexContainer.<br />
414 /// The proportion of the free space in the container, the flex item will receive.<br />
415 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
417 /// <since_tizen> 3 </since_tizen>
422 return (float)GetValue(FlexProperty);
426 SetValue(FlexProperty, value);
427 NotifyPropertyChanged();
432 /// The Child property of FlexContainer.<br />
433 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
435 /// <since_tizen> 3 </since_tizen>
440 return (int)GetValue(AlignSelfProperty);
444 SetValue(AlignSelfProperty, value);
445 NotifyPropertyChanged();
450 /// The Child property of FlexContainer.<br />
451 /// The space around the flex item.<br />
454 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
456 /// <since_tizen> 3 </since_tizen>
457 public Vector4 FlexMargin
461 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
462 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
466 SetValue(FlexMarginProperty, value);
467 NotifyPropertyChanged();
472 /// The top-left cell this child occupies, if not set, the first available cell is used.
475 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
477 /// <since_tizen> 3 </since_tizen>
478 public Vector2 CellIndex
482 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
483 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
487 SetValue(CellIndexProperty, value);
488 NotifyPropertyChanged();
493 /// The number of rows this child occupies, if not set, the default value is 1.
495 /// <since_tizen> 3 </since_tizen>
500 return (float)GetValue(RowSpanProperty);
504 SetValue(RowSpanProperty, value);
505 NotifyPropertyChanged();
510 /// The number of columns this child occupies, if not set, the default value is 1.
512 /// <since_tizen> 3 </since_tizen>
513 public float ColumnSpan
517 return (float)GetValue(ColumnSpanProperty);
521 SetValue(ColumnSpanProperty, value);
522 NotifyPropertyChanged();
527 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
529 /// <since_tizen> 3 </since_tizen>
530 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
534 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
538 SetValue(CellHorizontalAlignmentProperty, value);
539 NotifyPropertyChanged();
544 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
546 /// <since_tizen> 3 </since_tizen>
547 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
551 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
555 SetValue(CellVerticalAlignmentProperty, value);
556 NotifyPropertyChanged();
561 /// The left focusable view.<br />
562 /// This will return null if not set.<br />
563 /// This will also return null if the specified left focusable view is not on a window.<br />
565 /// <since_tizen> 3 </since_tizen>
566 public View LeftFocusableView
568 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
571 return (View)GetValue(LeftFocusableViewProperty);
575 SetValue(LeftFocusableViewProperty, value);
576 NotifyPropertyChanged();
581 /// The right focusable view.<br />
582 /// This will return null if not set.<br />
583 /// This will also return null if the specified right focusable view is not on a window.<br />
585 /// <since_tizen> 3 </since_tizen>
586 public View RightFocusableView
588 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
591 return (View)GetValue(RightFocusableViewProperty);
595 SetValue(RightFocusableViewProperty, value);
596 NotifyPropertyChanged();
601 /// The up focusable view.<br />
602 /// This will return null if not set.<br />
603 /// This will also return null if the specified up focusable view is not on a window.<br />
605 /// <since_tizen> 3 </since_tizen>
606 public View UpFocusableView
608 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
611 return (View)GetValue(UpFocusableViewProperty);
615 SetValue(UpFocusableViewProperty, value);
616 NotifyPropertyChanged();
621 /// The down focusable view.<br />
622 /// This will return null if not set.<br />
623 /// This will also return null if the specified down focusable view is not on a window.<br />
625 /// <since_tizen> 3 </since_tizen>
626 public View DownFocusableView
628 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
631 return (View)GetValue(DownFocusableViewProperty);
635 SetValue(DownFocusableViewProperty, value);
636 NotifyPropertyChanged();
641 /// Whether the view should be focusable by keyboard navigation.
643 /// <since_tizen> 3 </since_tizen>
644 public bool Focusable
648 SetValue(FocusableProperty, value);
649 NotifyPropertyChanged();
653 return (bool)GetValue(FocusableProperty);
658 /// Retrieves the position of the view.<br />
659 /// The coordinates are relative to the view's parent.<br />
661 /// <since_tizen> 3 </since_tizen>
662 public Position CurrentPosition
666 return GetCurrentPosition();
671 /// Sets the size of a view for the width and the height.<br />
672 /// Geometry can be scaled to fit within this area.<br />
673 /// This does not interfere with the view's scale factor.<br />
674 /// The views default depth is the minimum of width and height.<br />
677 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
678 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
680 /// <since_tizen> 3 </since_tizen>
685 Size2D temp = (Size2D)GetValue(Size2DProperty);
686 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
690 SetValue(Size2DProperty, value);
691 // Set Specification so when layouts measure this View it matches the value set here.
692 // All Views are currently Layouts.
693 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
694 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
695 _widthPolicy = value.Width;
696 _heightPolicy = value.Height;
697 _layout?.RequestLayout();
698 NotifyPropertyChanged();
703 /// Retrieves the size of the view.<br />
704 /// The coordinates are relative to the view's parent.<br />
706 /// <since_tizen> 3 </since_tizen>
707 public Size2D CurrentSize
711 return GetCurrentSize();
716 /// Retrieves and sets the view's opacity.<br />
720 /// Animatable - This property can be animated using <c>Animation</c> class.
723 /// <since_tizen> 3 </since_tizen>
728 return (float)GetValue(OpacityProperty);
732 SetValue(OpacityProperty, value);
733 NotifyPropertyChanged();
738 /// Sets the position of the view for X and Y.<br />
739 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
740 /// If the position inheritance is disabled, sets the world position.<br />
743 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
744 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
746 /// <since_tizen> 3 </since_tizen>
747 public Position2D Position2D
751 Position2D temp = (Position2D)GetValue(Position2DProperty);
752 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
756 SetValue(Position2DProperty, value);
757 NotifyPropertyChanged();
762 /// Retrieves the screen postion of the view.<br />
764 /// <since_tizen> 3 </since_tizen>
765 public Vector2 ScreenPosition
769 Vector2 temp = new Vector2(0.0f, 0.0f);
770 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
776 /// Determines whether the pivot point should be used to determine the position of the view.
777 /// This is true by default.
779 /// <remarks>If false, then the top-left of the view is used for the position.
780 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
782 /// <since_tizen> 3 </since_tizen>
783 public bool PositionUsesPivotPoint
787 return (bool)GetValue(PositionUsesPivotPointProperty);
791 SetValue(PositionUsesPivotPointProperty, value);
792 NotifyPropertyChanged();
797 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
799 /// <since_tizen> 3 </since_tizen>
800 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
802 "View view = new View(); " +
803 "view.PivotPoint = PivotPoint.Center; " +
804 "view.PositionUsesPivotPoint = true;" +
805 " Deprecated in API5: Will be removed in API8")]
806 [EditorBrowsable(EditorBrowsableState.Never)]
807 public bool PositionUsesAnchorPoint
812 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
817 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
818 NotifyPropertyChanged();
823 /// Queries whether the view is connected to the stage.<br />
824 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
826 /// <since_tizen> 3 </since_tizen>
827 public bool IsOnWindow
836 /// Gets the depth in the hierarchy for the view.
838 /// <since_tizen> 3 </since_tizen>
839 public int HierarchyDepth
843 return GetHierarchyDepth();
848 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
851 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
852 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
853 /// The values set by this property will likely change.
855 /// <since_tizen> 3 </since_tizen>
856 public int SiblingOrder
860 return (int)GetValue(SiblingOrderProperty);
864 SetValue(SiblingOrderProperty, value);
865 NotifyPropertyChanged();
870 /// Returns the natural size of the view.
873 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
875 /// <since_tizen> 5 </since_tizen>
876 public Vector3 NaturalSize
880 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
881 if (NDalicPINVOKE.SWIGPendingException.Pending)
882 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
888 /// Returns the natural size (Size2D) of the view.
891 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
893 /// <since_tizen> 4 </since_tizen>
894 public Size2D NaturalSize2D
898 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
899 if (NDalicPINVOKE.SWIGPendingException.Pending)
900 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
902 return new Size2D((int)temp.Width, (int)temp.Height);
907 /// Gets or sets the origin of a view within its parent's area.<br />
908 /// 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 />
909 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
910 /// A view's position is the distance between this origin and the view's anchor-point.<br />
912 /// <pre>The view has been initialized.</pre>
913 /// <since_tizen> 3 </since_tizen>
914 public Position ParentOrigin
918 Position tmp = (Position)GetValue(ParentOriginProperty);
919 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
923 SetValue(ParentOriginProperty, value);
924 NotifyPropertyChanged();
929 /// Gets or sets the anchor-point of a view.<br />
930 /// 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 />
931 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
932 /// A view position is the distance between its parent-origin and this anchor-point.<br />
933 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
934 /// <pre>The view has been initialized.</pre>
937 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
939 /// <since_tizen> 3 </since_tizen>
940 public Position PivotPoint
944 Position tmp = (Position)GetValue(PivotPointProperty);
945 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
949 SetValue(PivotPointProperty, value);
950 NotifyPropertyChanged();
955 /// Gets or sets the size width of the view.
959 /// Animatable - This property can be animated using <c>Animation</c> class.
962 /// <since_tizen> 3 </since_tizen>
963 public float SizeWidth
967 return (float)GetValue(SizeWidthProperty);
971 SetValue(SizeWidthProperty, value);
972 WidthSpecification = (int)Math.Ceiling(value);
973 NotifyPropertyChanged();
978 /// Gets or sets the size height of the view.
982 /// Animatable - This property can be animated using <c>Animation</c> class.
985 /// <since_tizen> 3 </since_tizen>
986 public float SizeHeight
990 return (float)GetValue(SizeHeightProperty);
994 SetValue(SizeHeightProperty, value);
995 HeightSpecification = (int)Math.Ceiling(value);
996 NotifyPropertyChanged();
1001 /// Gets or sets the position of the view.<br />
1002 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1003 /// If the position inheritance is disabled, sets the world position.<br />
1007 /// Animatable - This property can be animated using <c>Animation</c> class.
1009 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1011 /// <since_tizen> 3 </since_tizen>
1012 public Position Position
1016 Position tmp = (Position)GetValue(PositionProperty);
1017 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1021 SetValue(PositionProperty, value);
1022 NotifyPropertyChanged();
1027 /// Gets or sets the position X of the view.
1031 /// Animatable - This property can be animated using <c>Animation</c> class.
1034 /// <since_tizen> 3 </since_tizen>
1035 public float PositionX
1039 return (float)GetValue(PositionXProperty);
1043 SetValue(PositionXProperty, value);
1044 NotifyPropertyChanged();
1049 /// Gets or sets the position Y of the view.
1053 /// Animatable - This property can be animated using <c>Animation</c> class.
1056 /// <since_tizen> 3 </since_tizen>
1057 public float PositionY
1061 return (float)GetValue(PositionYProperty);
1065 SetValue(PositionYProperty, value);
1066 NotifyPropertyChanged();
1071 /// Gets or sets the position Z of the view.
1075 /// Animatable - This property can be animated using <c>Animation</c> class.
1078 /// <since_tizen> 3 </since_tizen>
1079 public float PositionZ
1083 return (float)GetValue(PositionZProperty);
1087 SetValue(PositionZProperty, value);
1088 NotifyPropertyChanged();
1093 /// Gets or sets the world position of the view.
1095 /// <since_tizen> 3 </since_tizen>
1096 public Vector3 WorldPosition
1100 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1101 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1107 /// Gets or sets the orientation of the view.<br />
1108 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1112 /// This is an asynchronous method.
1115 /// Animatable - This property can be animated using <c>Animation</c> class.
1118 /// <since_tizen> 3 </since_tizen>
1119 public Rotation Orientation
1123 return (Rotation)GetValue(OrientationProperty);
1127 SetValue(OrientationProperty, value);
1128 NotifyPropertyChanged();
1133 /// Gets or sets the world orientation of the view.<br />
1135 /// <since_tizen> 3 </since_tizen>
1136 public Rotation WorldOrientation
1140 Rotation temp = new Rotation();
1141 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1147 /// Gets or sets the scale factor applied to the view.<br />
1151 /// Animatable - This property can be animated using <c>Animation</c> class.
1153 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1155 /// <since_tizen> 3 </since_tizen>
1156 public Vector3 Scale
1160 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1161 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1165 SetValue(ScaleProperty, value);
1166 NotifyPropertyChanged();
1171 /// Gets or sets the scale X factor applied to the view.
1175 /// Animatable - This property can be animated using <c>Animation</c> class.
1178 /// <since_tizen> 3 </since_tizen>
1183 return (float)GetValue(ScaleXProperty);
1187 SetValue(ScaleXProperty, value);
1188 NotifyPropertyChanged();
1193 /// Gets or sets the scale Y factor applied to the view.
1197 /// Animatable - This property can be animated using <c>Animation</c> class.
1200 /// <since_tizen> 3 </since_tizen>
1205 return (float)GetValue(ScaleYProperty);
1209 SetValue(ScaleYProperty, value);
1210 NotifyPropertyChanged();
1215 /// Gets or sets the scale Z factor applied to the view.
1219 /// Animatable - This property can be animated using <c>Animation</c> class.
1222 /// <since_tizen> 3 </since_tizen>
1227 return (float)GetValue(ScaleZProperty);
1231 SetValue(ScaleZProperty, value);
1232 NotifyPropertyChanged();
1237 /// Gets the world scale of the view.
1239 /// <since_tizen> 3 </since_tizen>
1240 public Vector3 WorldScale
1244 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1245 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1251 /// Retrieves the visibility flag of the view.
1255 /// If the view is not visible, then the view and its children will not be rendered.
1256 /// 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.
1259 /// <since_tizen> 3 </since_tizen>
1260 public bool Visibility
1265 GetProperty(View.Property.VISIBLE).Get(out temp);
1271 /// Gets the view's world color.
1273 /// <since_tizen> 3 </since_tizen>
1274 public Vector4 WorldColor
1278 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1279 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1285 /// Gets or sets the view's name.
1287 /// <since_tizen> 3 </since_tizen>
1292 return (string)GetValue(NameProperty);
1296 SetValue(NameProperty, value);
1297 NotifyPropertyChanged();
1302 /// Get the number of children held by the view.
1304 /// <since_tizen> 3 </since_tizen>
1305 public new uint ChildCount
1309 return GetChildCount();
1314 /// Gets the view's ID.
1317 /// <since_tizen> 3 </since_tizen>
1327 /// Gets or sets the status of whether the view should emit touch or hover signals.
1329 /// <since_tizen> 3 </since_tizen>
1330 public bool Sensitive
1334 return (bool)GetValue(SensitiveProperty);
1338 SetValue(SensitiveProperty, value);
1339 NotifyPropertyChanged();
1344 /// 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.
1346 /// <since_tizen> 3 </since_tizen>
1347 public bool LeaveRequired
1351 return (bool)GetValue(LeaveRequiredProperty);
1355 SetValue(LeaveRequiredProperty, value);
1356 NotifyPropertyChanged();
1361 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1363 /// <since_tizen> 3 </since_tizen>
1364 public bool InheritOrientation
1368 return (bool)GetValue(InheritOrientationProperty);
1372 SetValue(InheritOrientationProperty, value);
1373 NotifyPropertyChanged();
1378 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1380 /// <since_tizen> 3 </since_tizen>
1381 public bool InheritScale
1385 return (bool)GetValue(InheritScaleProperty);
1389 SetValue(InheritScaleProperty, value);
1390 NotifyPropertyChanged();
1395 /// Gets or sets the status of how the view and its children should be drawn.<br />
1396 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1397 /// 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 />
1398 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1399 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1400 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1402 /// <since_tizen> 3 </since_tizen>
1403 public DrawModeType DrawMode
1407 return (DrawModeType)GetValue(DrawModeProperty);
1411 SetValue(DrawModeProperty, value);
1412 NotifyPropertyChanged();
1417 /// Gets or sets the relative to parent size factor of the view.<br />
1418 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1419 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1422 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1424 /// <since_tizen> 3 </since_tizen>
1425 public Vector3 SizeModeFactor
1429 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1430 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1434 SetValue(SizeModeFactorProperty, value);
1435 NotifyPropertyChanged();
1440 /// Gets or sets the width resize policy to be used.
1442 /// <since_tizen> 3 </since_tizen>
1443 public ResizePolicyType WidthResizePolicy
1447 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1451 SetValue(WidthResizePolicyProperty, value);
1452 // Match ResizePolicy to new Layouting.
1453 // Parent relative policies can not be mapped at this point as parent size unknown.
1456 case ResizePolicyType.UseNaturalSize:
1458 WidthSpecification = LayoutParamPolicies.WrapContent;
1461 case ResizePolicyType.FillToParent:
1463 WidthSpecification = LayoutParamPolicies.MatchParent;
1466 case ResizePolicyType.FitToChildren:
1468 WidthSpecification = LayoutParamPolicies.WrapContent;
1474 NotifyPropertyChanged();
1479 /// Gets or sets the height resize policy to be used.
1481 /// <since_tizen> 3 </since_tizen>
1482 public ResizePolicyType HeightResizePolicy
1486 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1490 SetValue(HeightResizePolicyProperty, value);
1491 // Match ResizePolicy to new Layouting.
1492 // Parent relative policies can not be mapped at this point as parent size unknown.
1495 case ResizePolicyType.UseNaturalSize:
1497 HeightSpecification = LayoutParamPolicies.WrapContent;
1500 case ResizePolicyType.FillToParent:
1502 HeightSpecification = LayoutParamPolicies.MatchParent;
1505 case ResizePolicyType.FitToChildren:
1507 HeightSpecification = LayoutParamPolicies.WrapContent;
1513 NotifyPropertyChanged();
1518 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1519 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1521 /// <since_tizen> 3 </since_tizen>
1522 public SizeScalePolicyType SizeScalePolicy
1526 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1530 SetValue(SizeScalePolicyProperty, value);
1531 NotifyPropertyChanged();
1536 /// Gets or sets the status of whether the width size is dependent on the height size.
1538 /// <since_tizen> 3 </since_tizen>
1539 public bool WidthForHeight
1543 return (bool)GetValue(WidthForHeightProperty);
1547 SetValue(WidthForHeightProperty, value);
1548 NotifyPropertyChanged();
1553 /// Gets or sets the status of whether the height size is dependent on the width size.
1555 /// <since_tizen> 3 </since_tizen>
1556 public bool HeightForWidth
1560 return (bool)GetValue(HeightForWidthProperty);
1564 SetValue(HeightForWidthProperty, value);
1565 NotifyPropertyChanged();
1570 /// Gets or sets the padding for use in layout.
1573 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1575 /// <since_tizen> 5 </since_tizen>
1576 public Extents Padding
1580 // If View has a Layout then padding in stored in the base Layout class
1583 return Layout.Padding;
1587 Extents temp = (Extents)GetValue(PaddingProperty);
1588 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1590 // Two return points to prevent creating a zeroed Extent native object before assignment
1594 Extents padding = value;
1597 // Layout set so store Padding in LayoutItem instead of in View.
1598 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1599 // the position and sizes measure in the Layouting.
1600 Layout.Padding = value;
1601 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1602 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1603 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1605 padding = new Extents(0,0,0,0); // Reset value stored in View.
1607 _layout?.RequestLayout();
1609 SetValue(PaddingProperty, padding);
1610 NotifyPropertyChanged();
1611 _layout?.RequestLayout();
1616 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1619 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1621 /// <since_tizen> 3 </since_tizen>
1622 public Size2D MinimumSize
1626 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1627 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1631 if (_layout != null)
1633 // Note: it only works if minimum size is >= than natural size.
1634 // To force the size it should be done through the width&height spec or Size2D.
1635 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1636 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1637 _layout.RequestLayout();
1639 SetValue(MinimumSizeProperty, value);
1640 NotifyPropertyChanged();
1645 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1648 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1650 /// <since_tizen> 3 </since_tizen>
1651 public Size2D MaximumSize
1655 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1656 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1660 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1661 // MATCH_PARENT spec + parent container size can be used to limit
1662 if (_layout != null)
1664 // Note: it only works if minimum size is >= than natural size.
1665 // To force the size it should be done through the width&height spec or Size2D.
1666 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1667 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1668 _layout.RequestLayout();
1670 SetValue(MaximumSizeProperty, value);
1671 NotifyPropertyChanged();
1676 /// Gets or sets whether a child view inherits it's parent's position.<br />
1677 /// Default is to inherit.<br />
1678 /// 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 />
1680 /// <since_tizen> 3 </since_tizen>
1681 public bool InheritPosition
1685 return (bool)GetValue(InheritPositionProperty);
1689 SetValue(InheritPositionProperty, value);
1690 NotifyPropertyChanged();
1695 /// Gets or sets the clipping behavior (mode) of it's children.
1697 /// <since_tizen> 3 </since_tizen>
1698 public ClippingModeType ClippingMode
1702 return (ClippingModeType)GetValue(ClippingModeProperty);
1706 SetValue(ClippingModeProperty, value);
1707 NotifyPropertyChanged();
1712 /// Gets the number of renderers held by the view.
1714 /// <since_tizen> 3 </since_tizen>
1715 public uint RendererCount
1719 return GetRendererCount();
1724 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1727 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1729 /// <since_tizen> 3 </since_tizen>
1730 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1732 "View view = new View(); " +
1733 "view.PivotPoint = PivotPoint.Center; " +
1734 "view.PositionUsesPivotPoint = true;")]
1735 [EditorBrowsable(EditorBrowsableState.Never)]
1736 public Position AnchorPoint
1740 Position temp = new Position(0.0f, 0.0f, 0.0f);
1741 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1742 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1746 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1747 NotifyPropertyChanged();
1752 /// Sets the size of a view for the width, the height and the depth.<br />
1753 /// Geometry can be scaled to fit within this area.<br />
1754 /// This does not interfere with the view's scale factor.<br />
1755 /// The views default depth is the minimum of width and height.<br />
1759 /// Animatable - This property can be animated using <c>Animation</c> class.
1761 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1763 /// <since_tizen> 5 </since_tizen>
1768 Size tmp = (Size)GetValue(SizeProperty);
1769 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1773 SetValue(SizeProperty, value);
1774 // Set Specification so when layouts measure this View it matches the value set here.
1775 // All Views are currently Layouts.
1776 WidthSpecification = (int)Math.Ceiling(value.Width);
1777 HeightSpecification = (int)Math.Ceiling(value.Height);
1778 NotifyPropertyChanged();
1783 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1785 /// <since_tizen> 3 </since_tizen>
1786 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1788 "Container parent = view.GetParent(); " +
1789 "View view = parent as View;")]
1790 [EditorBrowsable(EditorBrowsableState.Never)]
1791 public new View Parent
1796 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1797 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1798 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1800 if (basehandle is Layer layer)
1802 ret = new View(Layer.getCPtr(layer).Handle, false);
1803 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1807 ret = basehandle as View;
1810 Interop.BaseHandle.delete_BaseHandle(CPtr);
1811 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1813 if (NDalicPINVOKE.SWIGPendingException.Pending)
1814 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1820 /// Gets/Sets whether inherit parent's the layout Direction.
1822 /// <since_tizen> 4 </since_tizen>
1823 public bool InheritLayoutDirection
1827 return (bool)GetValue(InheritLayoutDirectionProperty);
1831 SetValue(InheritLayoutDirectionProperty, value);
1832 NotifyPropertyChanged();
1837 /// Gets/Sets the layout Direction.
1839 /// <since_tizen> 4 </since_tizen>
1840 public ViewLayoutDirectionType LayoutDirection
1844 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1848 SetValue(LayoutDirectionProperty, value);
1849 NotifyPropertyChanged();
1850 _layout?.RequestLayout();
1855 /// Gets or sets the Margin for use in layout.
1858 /// Margin property is supported by Layout algorithms and containers.
1859 /// Please Set Layout if you want to use Margin property.
1860 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1862 /// <since_tizen> 4 </since_tizen>
1863 public Extents Margin
1867 // If View has a Layout then margin is stored in Layout.
1870 return Layout.Margin;
1874 // If Layout not set then return margin stored in View.
1875 Extents temp = (Extents)GetValue(MarginProperty);
1876 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1878 // Two return points to prevent creating a zeroed Extent native object before assignment
1884 // Layout set so store Margin in LayoutItem instead of View.
1885 // If View stores the Margin too then the Legacy Size Negotiation will
1886 // overwrite the position and size values measured in the Layouting.
1887 Layout.Margin = value;
1888 SetValue(MarginProperty, new Extents(0,0,0,0));
1889 _layout?.RequestLayout();
1893 SetValue(MarginProperty, value);
1895 NotifyPropertyChanged();
1896 _layout?.RequestLayout();
1901 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1903 /// <since_tizen> 6 </since_tizen>
1904 public int WidthSpecification
1908 return _widthPolicy;
1912 _widthPolicy = value;
1913 if (_widthPolicy >= 0)
1915 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1917 if(_heightPolicy>=0) // Policy an exact value
1919 Size2D.Width = _widthPolicy;
1923 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1924 // Size2D height will store the specification value (negative number) this will then be applied to the
1925 // HeightSpecification when the Size2D callback is invoked.
1926 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1929 _layout?.RequestLayout();
1934 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1936 /// <since_tizen> 6 </since_tizen>
1937 public int HeightSpecification
1941 return _heightPolicy;
1945 _heightPolicy = value;
1946 if (_heightPolicy >= 0)
1948 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1950 if(_widthPolicy>=0) // Policy an exact value
1952 Size2D.Height = _heightPolicy;
1956 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1957 // Size2D height will store the specification value (negative number) this will then be applied to the
1958 // HeightSpecification when the Size2D callback is invoked.
1959 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1963 _layout?.RequestLayout();
1968 /// Gets the List of transitions for this View.
1970 /// <since_tizen> 6 </since_tizen>
1971 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
1975 if (_layoutTransitions == null)
1977 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1979 return _layoutTransitions;
1984 /// Set a layout transitions for this View.
1987 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
1989 /// <since_tizen> 6 </since_tizen>
1990 public LayoutTransition LayoutTransition
1994 if (_layoutTransitions == null)
1996 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1998 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2000 AttachTransitionsToChildren(value);
2005 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2008 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2010 /// <since_tizen> 4 </since_tizen>
2011 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2012 [EditorBrowsable(EditorBrowsableState.Never)]
2013 public Extents PaddingEX
2017 Extents temp = new Extents(0, 0, 0, 0);
2018 GetProperty(View.Property.PADDING).Get(temp);
2019 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2023 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2024 NotifyPropertyChanged();
2025 _layout?.RequestLayout();
2029 /// <since_tizen> 6 </since_tizen>
2030 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2031 [EditorBrowsable(EditorBrowsableState.Never)]
2032 public Style XamlStyle
2036 return (Style)GetValue(XamlStyleProperty);
2040 SetValue(XamlStyleProperty, value);
2045 /// The Color of View. This is an RGBA value.
2049 /// Animatable - This property can be animated using <c>Animation</c> class.
2051 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2053 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2054 [EditorBrowsable(EditorBrowsableState.Never)]
2059 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
2060 GetProperty(Interop.ActorProperty.Actor_Property_COLOR_get()).Get(temp);
2061 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2070 /// Set the layout on this View. Replaces any existing Layout.
2072 /// <since_tizen> 6 </since_tizen>
2073 public LayoutItem Layout
2081 // Do nothing if layout provided is already set on this View.
2082 if (value == _layout)
2087 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2088 layoutingDisabled = false;
2091 // If new layout being set already has a owner then that owner receives a replacement default layout.
2092 // First check if the layout to be set already has a owner.
2093 if (value?.Owner != null)
2095 // Previous owner of the layout gets a default layout as a replacement.
2096 value.Owner.Layout = new LayoutGroup();
2098 // Copy Margin and Padding to replacement LayoutGroup.
2099 value.Owner.Layout.Margin = value.Margin;
2100 value.Owner.Layout.Padding = value.Padding;
2103 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2104 // View if no replacement. Previously margin and padding values would have been moved from
2105 // the View to the layout.
2106 if (_layout != null ) // Existing layout
2110 // Existing layout being replaced so copy over margin and padding values.
2111 value.Margin = _layout.Margin;
2112 value.Padding = _layout.Padding;
2116 // Layout not being replaced so restore margin and padding to View.
2117 SetValue(MarginProperty, _layout.Margin);
2118 SetValue(PaddingProperty, _layout.Padding);
2119 NotifyPropertyChanged();
2124 // First Layout to be added to the View hence copy
2126 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2129 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2131 // If View already has a margin set then store it in Layout instead.
2132 value.Margin = Margin;
2133 SetValue(MarginProperty, new Extents(0,0,0,0));
2134 NotifyPropertyChanged();
2137 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2139 // If View already has a padding set then store it in Layout instead.
2140 value.Padding = Padding;
2141 SetValue(PaddingProperty, new Extents(0,0,0,0));
2142 NotifyPropertyChanged();
2147 // Remove existing layout from it's parent layout group.
2148 _layout?.Unparent();
2150 // Set layout to this view
2156 /// The weight of the View, used to share available space in a layout with siblings.
2158 /// <since_tizen> 6 </since_tizen>
2168 _layout?.RequestLayout();
2173 /// Whether to load the BackgroundImage synchronously.
2174 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2175 /// Note: For Normal Quad images only.
2177 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2178 [EditorBrowsable(EditorBrowsableState.Never)]
2179 public bool BackgroundImageSynchronosLoading
2183 return _backgroundImageSynchronosLoading;
2187 _backgroundImageSynchronosLoading = value;
2190 Background.Find(Visual.Property.Type)?.Get(out visualType);
2191 if (visualType == (int)Visual.Type.Image)
2193 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2196 if (bgUrl.Length != 0)
2198 PropertyMap bgMap = this.Background;
2199 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2205 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2206 [EditorBrowsable(EditorBrowsableState.Never)]
2207 public Vector2 UpdateSizeHint
2211 return (Vector2)GetValue(UpdateSizeHintProperty);
2215 SetValue(UpdateSizeHintProperty, value);
2216 NotifyPropertyChanged();
2220 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2221 [EditorBrowsable(EditorBrowsableState.Never)]
2222 public string[] TransitionNames
2226 return transitionNames;
2230 transitionNames = value;
2236 /// Get Style, it is abstract function and must be override.
2238 /// <since_tizen> 6 </since_tizen>
2239 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2240 [EditorBrowsable(EditorBrowsableState.Never)]
2241 protected virtual ViewStyle GetViewStyle()
2243 viewStyle = new ViewStyle();
2247 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2248 [EditorBrowsable(EditorBrowsableState.Never)]
2249 protected virtual bool OnControlStateChanged(ControlStates currentState)
2251 //If need to apply the state to all child, return true;
2254 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2256 var view = (View)bindable;
2257 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2259 defaultValueCreator: (bindable) =>
2261 var view = (View)bindable;
2262 return view.backgroundImageSelector;
2264 private TriggerableSelector<string> _backgroundImageSelector;
2265 private TriggerableSelector<string> backgroundImageSelector
2269 if (null == _backgroundImageSelector)
2271 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2273 return _backgroundImageSelector;
2276 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2278 var view = (View)bindable;
2279 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2281 defaultValueCreator: (bindable) =>
2283 var view = (View)bindable;
2284 return view.backgroundColorSelector;
2286 private TriggerableSelector<Color> _backgroundColorSelector;
2287 private TriggerableSelector<Color> backgroundColorSelector
2291 if (null == _backgroundColorSelector)
2293 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2295 return _backgroundColorSelector;
2298 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2300 var view = (View)bindable;
2301 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2303 defaultValueCreator: (bindable) =>
2305 var view = (View)bindable;
2306 return view.backgroundImageBorderSelector;
2308 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2309 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2313 if (null == _backgroundImageBorderSelector)
2315 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2317 return _backgroundImageBorderSelector;
2320 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2322 var view = (View)bindable;
2323 view.opacitySelector.Clone((Selector<float?>)newValue);
2325 defaultValueCreator: (bindable) =>
2327 var view = (View)bindable;
2328 return view.opacitySelector;
2330 private TriggerableSelector<float?> _opacitySelector;
2331 private TriggerableSelector<float?> opacitySelector
2335 if (null == _opacitySelector)
2337 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2339 return _opacitySelector;
2343 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2344 [EditorBrowsable(EditorBrowsableState.Never)]
2345 public virtual void ApplyStyle(ViewStyle viewStyle)
2347 if (null == viewStyle)
2352 if (this.viewStyle == viewStyle)
2357 if (null != this.viewStyle)
2359 simpleBinding.Clear();
2362 this.viewStyle = viewStyle;
2364 Dictionary<string, BindableProperty> bindablePropertyOfView;
2365 Type viewType = GetType();
2367 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2368 Type styleType = viewStyle.GetType();
2370 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2371 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2373 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2375 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2377 BindableProperty viewProperty;
2378 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2380 if (null != viewProperty)
2382 object value = viewStyle.GetValue(keyValuePair.Value);
2386 SetValue(viewProperty, value);
2389 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2395 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2396 [EditorBrowsable(EditorBrowsableState.Never)]
2397 private BundledPipe simpleBinding = new BundledPipe();