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 ControlStates controlStates;
176 /// Get/Set the control state.
178 /// <since_tizen> 6 </since_tizen>
179 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
180 [EditorBrowsable(EditorBrowsableState.Never)]
181 public ControlStates ControlState
185 return controlStates;
189 if (controlStates == value)
194 var prevState = controlStates;
196 controlStates = value;
198 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
200 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
202 OnControlStateChanged(changeInfo);
204 if (controlStatePropagation)
206 foreach (View child in Children)
208 child.ControlState = value;
212 ControlStateChangedEvent?.Invoke(this, changeInfo);
216 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
217 [EditorBrowsable(EditorBrowsableState.Never)]
218 public bool IsResourcesCreated
222 return Application.Current.IsResourcesCreated;
226 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
227 [EditorBrowsable(EditorBrowsableState.Never)]
228 public ResourceDictionary XamlResources
232 return Application.Current.XamlResources;
236 Application.Current.XamlResources = value;
241 /// The StyleName, type string.
243 /// <since_tizen> 3 </since_tizen>
244 public string StyleName
248 return (string)GetValue(StyleNameProperty);
252 SetValue(StyleNameProperty, value);
253 NotifyPropertyChanged();
258 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
261 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
263 /// <since_tizen> 3 </since_tizen>
264 public Color BackgroundColor
268 Color temp = (Color)GetValue(BackgroundColorProperty);
269 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
273 if (viewStyle != null)
275 viewStyle.BackgroundImage = null;
276 viewStyle.BackgroundColor = value;
280 SetValue(BackgroundColorProperty, value);
283 NotifyPropertyChanged();
288 /// The mutually exclusive with "backgroundColor" and "background" type Map.
290 /// <since_tizen> 3 </since_tizen>
291 public string BackgroundImage
295 return (string)GetValue(BackgroundImageProperty);
299 if (viewStyle != null)
301 viewStyle.BackgroundColor = null;
302 viewStyle.BackgroundImage = value;
306 SetValue(BackgroundImageProperty, value);
309 NotifyPropertyChanged();
314 /// Get or set the border of background image.
316 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
317 [EditorBrowsable(EditorBrowsableState.Never)]
318 public Rectangle BackgroundImageBorder
322 return (Rectangle)GetValue(BackgroundImageBorderProperty);
326 if (viewStyle != null)
328 viewStyle.BackgroundImageBorder = value;
332 SetValue(BackgroundImageBorderProperty, value);
335 NotifyPropertyChanged();
340 /// The background of view.
342 /// <since_tizen> 3 </since_tizen>
343 public Tizen.NUI.PropertyMap Background
347 return (PropertyMap)GetValue(BackgroundProperty);
351 SetValue(BackgroundProperty, value);
352 NotifyPropertyChanged();
357 /// Describes a shadow as an image for a View.
358 /// It is null by default.
361 /// Gettter returns copied instance of current shadow.
364 /// The mutually exclusive with "BoxShadow".
366 [EditorBrowsable(EditorBrowsableState.Never)]
367 public ImageShadow ImageShadow
371 return (ImageShadow)GetValue(ImageShadowProperty);
375 SetValue(ImageShadowProperty, value);
376 NotifyPropertyChanged();
381 /// Describes a box shaped shadow drawing for a View.
382 /// It is null by default.
385 /// Gettter returns copied instance of current shadow.
388 /// The mutually exclusive with "ImageShadow".
390 [EditorBrowsable(EditorBrowsableState.Never)]
391 public Shadow BoxShadow
395 return (Shadow)GetValue(BoxShadowProperty);
399 SetValue(BoxShadowProperty, value);
400 NotifyPropertyChanged();
405 /// The radius for the rounded corners of the View.
406 /// This will rounds background and shadow edges.
407 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
409 [EditorBrowsable(EditorBrowsableState.Never)]
410 public float CornerRadius
414 return (float)GetValue(CornerRadiusProperty);
418 SetValue(CornerRadiusProperty, value);
419 NotifyPropertyChanged();
424 /// The current state of the view.
426 /// <since_tizen> 3 </since_tizen>
431 return (States)GetValue(StateProperty);
435 SetValue(StateProperty, value);
436 NotifyPropertyChanged();
441 /// The current sub state of the view.
443 /// <since_tizen> 3 </since_tizen>
444 public States SubState
448 return (States)GetValue(SubStateProperty);
452 SetValue(SubStateProperty, value);
453 NotifyPropertyChanged();
458 /// Displays a tooltip
460 /// <since_tizen> 3 </since_tizen>
461 public Tizen.NUI.PropertyMap Tooltip
465 return (PropertyMap)GetValue(TooltipProperty);
469 SetValue(TooltipProperty, value);
470 NotifyPropertyChanged();
475 /// Displays a tooltip as a text.
477 /// <since_tizen> 3 </since_tizen>
478 public string TooltipText
482 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
483 NotifyPropertyChanged();
488 /// The Child property of FlexContainer.<br />
489 /// The proportion of the free space in the container, the flex item will receive.<br />
490 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
492 /// <since_tizen> 3 </since_tizen>
493 [Obsolete("Deprecated in API8, will be removed in API10.")]
498 return (float)GetValue(FlexProperty);
502 SetValue(FlexProperty, value);
503 NotifyPropertyChanged();
508 /// The Child property of FlexContainer.<br />
509 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
511 /// <since_tizen> 3 </since_tizen>
512 [Obsolete("Deprecated in API8, will be removed in API10.")]
517 return (int)GetValue(AlignSelfProperty);
521 SetValue(AlignSelfProperty, value);
522 NotifyPropertyChanged();
527 /// The Child property of FlexContainer.<br />
528 /// The space around the flex item.<br />
531 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
533 /// <since_tizen> 3 </since_tizen>
534 [Obsolete("Deprecated in API8, will be removed in API10.")]
535 public Vector4 FlexMargin
539 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
540 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
544 SetValue(FlexMarginProperty, value);
545 NotifyPropertyChanged();
550 /// The top-left cell this child occupies, if not set, the first available cell is used.
553 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
555 /// <since_tizen> 3 </since_tizen>
556 public Vector2 CellIndex
560 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
561 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
565 SetValue(CellIndexProperty, value);
566 NotifyPropertyChanged();
571 /// The number of rows this child occupies, if not set, the default value is 1.
573 /// <since_tizen> 3 </since_tizen>
578 return (float)GetValue(RowSpanProperty);
582 SetValue(RowSpanProperty, value);
583 NotifyPropertyChanged();
588 /// The number of columns this child occupies, if not set, the default value is 1.
590 /// <since_tizen> 3 </since_tizen>
591 public float ColumnSpan
595 return (float)GetValue(ColumnSpanProperty);
599 SetValue(ColumnSpanProperty, value);
600 NotifyPropertyChanged();
605 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
607 /// <since_tizen> 3 </since_tizen>
608 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
612 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
616 SetValue(CellHorizontalAlignmentProperty, value);
617 NotifyPropertyChanged();
622 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
624 /// <since_tizen> 3 </since_tizen>
625 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
629 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
633 SetValue(CellVerticalAlignmentProperty, value);
634 NotifyPropertyChanged();
639 /// The left focusable view.<br />
640 /// This will return null if not set.<br />
641 /// This will also return null if the specified left focusable view is not on a window.<br />
643 /// <since_tizen> 3 </since_tizen>
644 public View LeftFocusableView
646 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
649 return (View)GetValue(LeftFocusableViewProperty);
653 SetValue(LeftFocusableViewProperty, value);
654 NotifyPropertyChanged();
659 /// The right focusable view.<br />
660 /// This will return null if not set.<br />
661 /// This will also return null if the specified right focusable view is not on a window.<br />
663 /// <since_tizen> 3 </since_tizen>
664 public View RightFocusableView
666 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
669 return (View)GetValue(RightFocusableViewProperty);
673 SetValue(RightFocusableViewProperty, value);
674 NotifyPropertyChanged();
679 /// The up focusable view.<br />
680 /// This will return null if not set.<br />
681 /// This will also return null if the specified up focusable view is not on a window.<br />
683 /// <since_tizen> 3 </since_tizen>
684 public View UpFocusableView
686 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
689 return (View)GetValue(UpFocusableViewProperty);
693 SetValue(UpFocusableViewProperty, value);
694 NotifyPropertyChanged();
699 /// The down focusable view.<br />
700 /// This will return null if not set.<br />
701 /// This will also return null if the specified down focusable view is not on a window.<br />
703 /// <since_tizen> 3 </since_tizen>
704 public View DownFocusableView
706 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
709 return (View)GetValue(DownFocusableViewProperty);
713 SetValue(DownFocusableViewProperty, value);
714 NotifyPropertyChanged();
719 /// Whether the view should be focusable by keyboard navigation.
721 /// <since_tizen> 3 </since_tizen>
722 public bool Focusable
726 SetValue(FocusableProperty, value);
727 NotifyPropertyChanged();
731 return (bool)GetValue(FocusableProperty);
736 /// Retrieves the position of the view.<br />
737 /// The coordinates are relative to the view's parent.<br />
739 /// <since_tizen> 3 </since_tizen>
740 public Position CurrentPosition
744 return GetCurrentPosition();
749 /// Sets the size of a view for the width and the height.<br />
750 /// Geometry can be scaled to fit within this area.<br />
751 /// This does not interfere with the view's scale factor.<br />
752 /// The views default depth is the minimum of width and height.<br />
755 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
756 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
758 /// <since_tizen> 3 </since_tizen>
763 Size2D temp = (Size2D)GetValue(Size2DProperty);
764 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
768 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
769 SetValue(Size2DProperty, value);
770 // Set Specification so when layouts measure this View it matches the value set here.
771 // All Views are currently Layouts.
772 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
773 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
774 _widthPolicy = value.Width;
775 _heightPolicy = value.Height;
776 _layout?.RequestLayout();
777 NotifyPropertyChanged();
782 /// Retrieves the size of the view.<br />
783 /// The coordinates are relative to the view's parent.<br />
785 /// <since_tizen> 3 </since_tizen>
786 public Size2D CurrentSize
790 return GetCurrentSize();
795 /// Retrieves and sets the view's opacity.<br />
797 /// <since_tizen> 3 </since_tizen>
802 return (float)GetValue(OpacityProperty);
806 if (viewStyle != null)
808 viewStyle.Opacity = value;
812 SetValue(OpacityProperty, value);
815 NotifyPropertyChanged();
820 /// Sets the position of the view for X and Y.<br />
821 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
822 /// If the position inheritance is disabled, sets the world position.<br />
825 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
826 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
828 /// <since_tizen> 3 </since_tizen>
829 public Position2D Position2D
833 Position2D temp = (Position2D)GetValue(Position2DProperty);
834 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
838 SetValue(Position2DProperty, value);
839 NotifyPropertyChanged();
844 /// Retrieves the screen postion of the view.<br />
846 /// <since_tizen> 3 </since_tizen>
847 public Vector2 ScreenPosition
851 Vector2 temp = new Vector2(0.0f, 0.0f);
852 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
858 /// Determines whether the pivot point should be used to determine the position of the view.
859 /// This is true by default.
861 /// <remarks>If false, then the top-left of the view is used for the position.
862 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
864 /// <since_tizen> 3 </since_tizen>
865 public bool PositionUsesPivotPoint
869 return (bool)GetValue(PositionUsesPivotPointProperty);
873 SetValue(PositionUsesPivotPointProperty, value);
874 NotifyPropertyChanged();
879 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
881 /// <since_tizen> 3 </since_tizen>
882 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
884 "View view = new View(); " +
885 "view.PivotPoint = PivotPoint.Center; " +
886 "view.PositionUsesPivotPoint = true;" +
887 " Deprecated in API5: Will be removed in API8")]
888 [EditorBrowsable(EditorBrowsableState.Never)]
889 public bool PositionUsesAnchorPoint
894 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
899 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
900 NotifyPropertyChanged();
905 /// Queries whether the view is connected to the stage.<br />
906 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
908 /// <since_tizen> 3 </since_tizen>
909 public bool IsOnWindow
918 /// Gets the depth in the hierarchy for the view.
920 /// <since_tizen> 3 </since_tizen>
921 public int HierarchyDepth
925 return GetHierarchyDepth();
930 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
933 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
934 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
935 /// The values set by this property will likely change.
937 /// <since_tizen> 3 </since_tizen>
938 public int SiblingOrder
942 return (int)GetValue(SiblingOrderProperty);
946 SetValue(SiblingOrderProperty, value);
948 LayoutGroup layout = Layout as LayoutGroup;
949 layout?.ChangeLayoutSiblingOrder(value);
951 NotifyPropertyChanged();
956 /// Returns the natural size of the view.
959 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
961 /// <since_tizen> 5 </since_tizen>
962 public Vector3 NaturalSize
966 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
967 if (NDalicPINVOKE.SWIGPendingException.Pending)
968 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
974 /// Returns the natural size (Size2D) of the view.
977 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
979 /// <since_tizen> 4 </since_tizen>
980 public Size2D NaturalSize2D
984 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
985 if (NDalicPINVOKE.SWIGPendingException.Pending)
986 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
988 return new Size2D((int)temp.Width, (int)temp.Height);
993 /// Gets or sets the origin of a view within its parent's area.<br />
994 /// 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 />
995 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
996 /// A view's position is the distance between this origin and the view's anchor-point.<br />
998 /// <pre>The view has been initialized.</pre>
999 /// <since_tizen> 3 </since_tizen>
1000 public Position ParentOrigin
1004 Position tmp = (Position)GetValue(ParentOriginProperty);
1005 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1009 SetValue(ParentOriginProperty, value);
1010 NotifyPropertyChanged();
1015 /// Gets or sets the anchor-point of a view.<br />
1016 /// 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 />
1017 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1018 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1019 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1020 /// <pre>The view has been initialized.</pre>
1023 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1025 /// <since_tizen> 3 </since_tizen>
1026 public Position PivotPoint
1030 Position tmp = (Position)GetValue(PivotPointProperty);
1031 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1035 SetValue(PivotPointProperty, value);
1036 NotifyPropertyChanged();
1041 /// Gets or sets the size width of the view.
1045 /// Animatable - This property can be animated using <c>Animation</c> class.
1048 /// <since_tizen> 3 </since_tizen>
1049 public float SizeWidth
1053 return (float)GetValue(SizeWidthProperty);
1057 SetValue(SizeWidthProperty, value);
1058 NotifyPropertyChanged();
1063 /// Gets or sets the size height of the view.
1067 /// Animatable - This property can be animated using <c>Animation</c> class.
1070 /// <since_tizen> 3 </since_tizen>
1071 public float SizeHeight
1075 return (float)GetValue(SizeHeightProperty);
1079 SetValue(SizeHeightProperty, value);
1080 NotifyPropertyChanged();
1085 /// Gets or sets the position of the view.<br />
1086 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1087 /// If the position inheritance is disabled, sets the world position.<br />
1091 /// Animatable - This property can be animated using <c>Animation</c> class.
1093 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1095 /// <since_tizen> 3 </since_tizen>
1096 public Position Position
1100 Position tmp = (Position)GetValue(PositionProperty);
1101 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1105 SetValue(PositionProperty, value);
1106 NotifyPropertyChanged();
1111 /// Gets or sets the position X of the view.
1115 /// Animatable - This property can be animated using <c>Animation</c> class.
1118 /// <since_tizen> 3 </since_tizen>
1119 public float PositionX
1123 return (float)GetValue(PositionXProperty);
1127 SetValue(PositionXProperty, value);
1128 NotifyPropertyChanged();
1133 /// Gets or sets the position Y of the view.
1137 /// Animatable - This property can be animated using <c>Animation</c> class.
1140 /// <since_tizen> 3 </since_tizen>
1141 public float PositionY
1145 return (float)GetValue(PositionYProperty);
1149 SetValue(PositionYProperty, value);
1150 NotifyPropertyChanged();
1155 /// Gets or sets the position Z of the view.
1159 /// Animatable - This property can be animated using <c>Animation</c> class.
1162 /// <since_tizen> 3 </since_tizen>
1163 public float PositionZ
1167 return (float)GetValue(PositionZProperty);
1171 SetValue(PositionZProperty, value);
1172 NotifyPropertyChanged();
1177 /// Gets or sets the world position of the view.
1179 /// <since_tizen> 3 </since_tizen>
1180 public Vector3 WorldPosition
1184 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1185 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1191 /// Gets or sets the orientation of the view.<br />
1192 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1196 /// This is an asynchronous method.
1199 /// Animatable - This property can be animated using <c>Animation</c> class.
1202 /// <since_tizen> 3 </since_tizen>
1203 public Rotation Orientation
1207 return (Rotation)GetValue(OrientationProperty);
1211 SetValue(OrientationProperty, value);
1212 NotifyPropertyChanged();
1217 /// Gets or sets the world orientation of the view.<br />
1219 /// <since_tizen> 3 </since_tizen>
1220 public Rotation WorldOrientation
1224 Rotation temp = new Rotation();
1225 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1231 /// Gets or sets the scale factor applied to the view.<br />
1235 /// Animatable - This property can be animated using <c>Animation</c> class.
1237 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1239 /// <since_tizen> 3 </since_tizen>
1240 public Vector3 Scale
1244 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1245 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1249 SetValue(ScaleProperty, value);
1250 NotifyPropertyChanged();
1255 /// Gets or sets the scale X factor applied to the view.
1259 /// Animatable - This property can be animated using <c>Animation</c> class.
1262 /// <since_tizen> 3 </since_tizen>
1267 return (float)GetValue(ScaleXProperty);
1271 SetValue(ScaleXProperty, value);
1272 NotifyPropertyChanged();
1277 /// Gets or sets the scale Y factor applied to the view.
1281 /// Animatable - This property can be animated using <c>Animation</c> class.
1284 /// <since_tizen> 3 </since_tizen>
1289 return (float)GetValue(ScaleYProperty);
1293 SetValue(ScaleYProperty, value);
1294 NotifyPropertyChanged();
1299 /// Gets or sets the scale Z factor applied to the view.
1303 /// Animatable - This property can be animated using <c>Animation</c> class.
1306 /// <since_tizen> 3 </since_tizen>
1311 return (float)GetValue(ScaleZProperty);
1315 SetValue(ScaleZProperty, value);
1316 NotifyPropertyChanged();
1321 /// Gets the world scale of the view.
1323 /// <since_tizen> 3 </since_tizen>
1324 public Vector3 WorldScale
1328 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1329 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1335 /// Retrieves the visibility flag of the view.
1339 /// If the view is not visible, then the view and its children will not be rendered.
1340 /// 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.
1343 /// Animatable - This property can be animated using <c>Animation</c> class.
1346 /// <since_tizen> 3 </since_tizen>
1347 public bool Visibility
1352 GetProperty(View.Property.VISIBLE).Get(out temp);
1358 /// Gets the view's world color.
1360 /// <since_tizen> 3 </since_tizen>
1361 public Vector4 WorldColor
1365 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1366 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1372 /// Gets or sets the view's name.
1374 /// <since_tizen> 3 </since_tizen>
1379 return (string)GetValue(NameProperty);
1383 SetValue(NameProperty, value);
1384 NotifyPropertyChanged();
1389 /// Get the number of children held by the view.
1391 /// <since_tizen> 3 </since_tizen>
1392 public new uint ChildCount
1396 return GetChildCount();
1401 /// Gets the view's ID.
1404 /// <since_tizen> 3 </since_tizen>
1414 /// Gets or sets the status of whether the view should emit touch or hover signals.
1416 /// <since_tizen> 3 </since_tizen>
1417 public bool Sensitive
1421 return (bool)GetValue(SensitiveProperty);
1425 SetValue(SensitiveProperty, value);
1426 NotifyPropertyChanged();
1431 /// 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.
1433 /// <since_tizen> 3 </since_tizen>
1434 public bool LeaveRequired
1438 return (bool)GetValue(LeaveRequiredProperty);
1442 SetValue(LeaveRequiredProperty, value);
1443 NotifyPropertyChanged();
1448 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1450 /// <since_tizen> 3 </since_tizen>
1451 public bool InheritOrientation
1455 return (bool)GetValue(InheritOrientationProperty);
1459 SetValue(InheritOrientationProperty, value);
1460 NotifyPropertyChanged();
1465 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1467 /// <since_tizen> 3 </since_tizen>
1468 public bool InheritScale
1472 return (bool)GetValue(InheritScaleProperty);
1476 SetValue(InheritScaleProperty, value);
1477 NotifyPropertyChanged();
1482 /// Gets or sets the status of how the view and its children should be drawn.<br />
1483 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1484 /// 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 />
1485 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1486 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1487 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1489 /// <since_tizen> 3 </since_tizen>
1490 public DrawModeType DrawMode
1494 return (DrawModeType)GetValue(DrawModeProperty);
1498 SetValue(DrawModeProperty, value);
1499 NotifyPropertyChanged();
1504 /// Gets or sets the relative to parent size factor of the view.<br />
1505 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1506 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1509 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1511 /// <since_tizen> 3 </since_tizen>
1512 public Vector3 SizeModeFactor
1516 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1517 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1521 SetValue(SizeModeFactorProperty, value);
1522 NotifyPropertyChanged();
1527 /// Gets or sets the width resize policy to be used.
1529 /// <since_tizen> 3 </since_tizen>
1530 public ResizePolicyType WidthResizePolicy
1534 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1538 SetValue(WidthResizePolicyProperty, value);
1539 NotifyPropertyChanged();
1544 /// Gets or sets the height resize policy to be used.
1546 /// <since_tizen> 3 </since_tizen>
1547 public ResizePolicyType HeightResizePolicy
1551 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1555 SetValue(HeightResizePolicyProperty, value);
1556 NotifyPropertyChanged();
1561 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1562 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1564 /// <since_tizen> 3 </since_tizen>
1565 public SizeScalePolicyType SizeScalePolicy
1569 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1573 SetValue(SizeScalePolicyProperty, value);
1574 NotifyPropertyChanged();
1579 /// Gets or sets the status of whether the width size is dependent on the height size.
1581 /// <since_tizen> 3 </since_tizen>
1582 public bool WidthForHeight
1586 return (bool)GetValue(WidthForHeightProperty);
1590 SetValue(WidthForHeightProperty, value);
1591 NotifyPropertyChanged();
1596 /// Gets or sets the status of whether the height size is dependent on the width size.
1598 /// <since_tizen> 3 </since_tizen>
1599 public bool HeightForWidth
1603 return (bool)GetValue(HeightForWidthProperty);
1607 SetValue(HeightForWidthProperty, value);
1608 NotifyPropertyChanged();
1613 /// Gets or sets the padding for use in layout.
1616 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1618 /// <since_tizen> 5 </since_tizen>
1619 public Extents Padding
1623 // If View has a Layout then padding in stored in the base Layout class
1626 return Layout.Padding;
1630 Extents temp = (Extents)GetValue(PaddingProperty);
1631 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1633 // Two return points to prevent creating a zeroed Extent native object before assignment
1637 Extents padding = value;
1640 // Layout set so store Padding in LayoutItem instead of in View.
1641 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1642 // the position and sizes measure in the Layouting.
1643 Layout.Padding = value;
1644 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1645 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1646 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1648 padding = new Extents(0,0,0,0); // Reset value stored in View.
1650 _layout?.RequestLayout();
1652 SetValue(PaddingProperty, padding);
1653 NotifyPropertyChanged();
1654 _layout?.RequestLayout();
1659 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1662 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1664 /// <since_tizen> 3 </since_tizen>
1665 public Size2D MinimumSize
1669 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1670 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1674 if (_layout != null)
1676 // Note: it only works if minimum size is >= than natural size.
1677 // To force the size it should be done through the width&height spec or Size2D.
1678 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1679 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1680 _layout.RequestLayout();
1682 SetValue(MinimumSizeProperty, value);
1683 NotifyPropertyChanged();
1688 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1691 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1693 /// <since_tizen> 3 </since_tizen>
1694 public Size2D MaximumSize
1698 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1699 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1703 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1704 // MATCH_PARENT spec + parent container size can be used to limit
1705 if (_layout != null)
1707 _layout.RequestLayout();
1709 SetValue(MaximumSizeProperty, value);
1710 NotifyPropertyChanged();
1715 /// Gets or sets whether a child view inherits it's parent's position.<br />
1716 /// Default is to inherit.<br />
1717 /// 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 />
1719 /// <since_tizen> 3 </since_tizen>
1720 public bool InheritPosition
1724 return (bool)GetValue(InheritPositionProperty);
1728 SetValue(InheritPositionProperty, value);
1729 NotifyPropertyChanged();
1734 /// Gets or sets the clipping behavior (mode) of it's children.
1736 /// <since_tizen> 3 </since_tizen>
1737 public ClippingModeType ClippingMode
1741 return (ClippingModeType)GetValue(ClippingModeProperty);
1745 SetValue(ClippingModeProperty, value);
1746 NotifyPropertyChanged();
1751 /// Gets the number of renderers held by the view.
1753 /// <since_tizen> 3 </since_tizen>
1754 public uint RendererCount
1758 return GetRendererCount();
1763 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1766 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1768 /// <since_tizen> 3 </since_tizen>
1769 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1771 "View view = new View(); " +
1772 "view.PivotPoint = PivotPoint.Center; " +
1773 "view.PositionUsesPivotPoint = true;")]
1774 [EditorBrowsable(EditorBrowsableState.Never)]
1775 public Position AnchorPoint
1779 Position temp = new Position(0.0f, 0.0f, 0.0f);
1780 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1781 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1785 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1786 NotifyPropertyChanged();
1791 /// Sets the size of a view for the width, the height and the depth.<br />
1792 /// Geometry can be scaled to fit within this area.<br />
1793 /// This does not interfere with the view's scale factor.<br />
1794 /// The views default depth is the minimum of width and height.<br />
1798 /// Animatable - This property can be animated using <c>Animation</c> class.
1800 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1802 /// <since_tizen> 5 </since_tizen>
1807 Size tmp = (Size)GetValue(SizeProperty);
1808 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1812 SetValue(SizeProperty, value);
1813 NotifyPropertyChanged();
1818 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1820 /// <since_tizen> 3 </since_tizen>
1821 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1823 "Container parent = view.GetParent(); " +
1824 "View view = parent as View;")]
1825 [EditorBrowsable(EditorBrowsableState.Never)]
1826 public new View Parent
1831 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1832 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1833 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1835 if (basehandle is Layer layer)
1837 ret = new View(Layer.getCPtr(layer).Handle, false);
1838 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1842 ret = basehandle as View;
1845 Interop.BaseHandle.delete_BaseHandle(CPtr);
1846 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1848 if (NDalicPINVOKE.SWIGPendingException.Pending)
1849 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1855 /// Gets/Sets whether inherit parent's the layout Direction.
1857 /// <since_tizen> 4 </since_tizen>
1858 public bool InheritLayoutDirection
1862 return (bool)GetValue(InheritLayoutDirectionProperty);
1866 SetValue(InheritLayoutDirectionProperty, value);
1867 NotifyPropertyChanged();
1872 /// Gets/Sets the layout Direction.
1874 /// <since_tizen> 4 </since_tizen>
1875 public ViewLayoutDirectionType LayoutDirection
1879 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1883 SetValue(LayoutDirectionProperty, value);
1884 NotifyPropertyChanged();
1885 _layout?.RequestLayout();
1890 /// Gets or sets the Margin for use in layout.
1893 /// Margin property is supported by Layout algorithms and containers.
1894 /// Please Set Layout if you want to use Margin property.
1895 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1897 /// <since_tizen> 4 </since_tizen>
1898 public Extents Margin
1902 // If View has a Layout then margin is stored in Layout.
1905 return Layout.Margin;
1909 // If Layout not set then return margin stored in View.
1910 Extents temp = (Extents)GetValue(MarginProperty);
1911 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1913 // Two return points to prevent creating a zeroed Extent native object before assignment
1919 // Layout set so store Margin in LayoutItem instead of View.
1920 // If View stores the Margin too then the Legacy Size Negotiation will
1921 // overwrite the position and size values measured in the Layouting.
1922 Layout.Margin = value;
1923 SetValue(MarginProperty, new Extents(0,0,0,0));
1924 _layout?.RequestLayout();
1928 SetValue(MarginProperty, value);
1930 NotifyPropertyChanged();
1931 _layout?.RequestLayout();
1936 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1938 /// <since_tizen> 6 </since_tizen>
1939 public int WidthSpecification
1943 return _widthPolicy;
1947 _widthPolicy = value;
1948 if( _oldWidthPolicy != _widthPolicy )
1950 if (_widthPolicy >= 0)
1952 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1954 if(_heightPolicy>=0) // Policy an exact value
1956 Size2D.Width = _widthPolicy;
1960 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1961 // Size2D height will store the specification value (negative number) this will then be applied to the
1962 // HeightSpecification when the Size2D callback is invoked.
1963 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1966 _layout?.RequestLayout();
1967 _oldWidthPolicy = _widthPolicy;
1973 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1975 /// <since_tizen> 6 </since_tizen>
1976 public int HeightSpecification
1980 return _heightPolicy;
1984 _heightPolicy = value;
1985 if( _oldHeightPolicy != _heightPolicy )
1987 if (_heightPolicy >= 0)
1989 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1991 if(_widthPolicy>=0) // Policy an exact value
1993 Size2D.Height = _heightPolicy;
1997 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1998 // Size2D height will store the specification value (negative number) this will then be applied to the
1999 // HeightSpecification when the Size2D callback is invoked.
2000 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2004 _layout?.RequestLayout();
2005 _oldHeightPolicy = _heightPolicy;
2011 /// Gets the List of transitions for this View.
2013 /// <since_tizen> 6 </since_tizen>
2014 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2018 if (_layoutTransitions == null)
2020 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2022 return _layoutTransitions;
2027 /// Set a layout transitions for this View.
2030 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2032 /// <since_tizen> 6 </since_tizen>
2033 public LayoutTransition LayoutTransition
2037 if (_layoutTransitions == null)
2039 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2041 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2043 AttachTransitionsToChildren(value);
2048 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2051 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2053 /// <since_tizen> 4 </since_tizen>
2054 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2055 [EditorBrowsable(EditorBrowsableState.Never)]
2056 public Extents PaddingEX
2060 Extents temp = new Extents(0, 0, 0, 0);
2061 GetProperty(View.Property.PADDING).Get(temp);
2062 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2066 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2067 NotifyPropertyChanged();
2068 _layout?.RequestLayout();
2072 /// <since_tizen> 6 </since_tizen>
2073 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2074 [EditorBrowsable(EditorBrowsableState.Never)]
2075 public Style XamlStyle
2079 return (Style)GetValue(XamlStyleProperty);
2083 SetValue(XamlStyleProperty, value);
2088 /// The Color of View. This is an RGBA value.
2092 /// Animatable - This property can be animated using <c>Animation</c> class.
2094 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2096 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2097 [EditorBrowsable(EditorBrowsableState.Never)]
2102 Color temp = (Color)GetValue(ColorProperty);
2103 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2107 if (viewStyle != null)
2109 viewStyle.Color = value;
2113 SetValue(ColorProperty, value);
2116 NotifyPropertyChanged();
2121 /// Set the layout on this View. Replaces any existing Layout.
2123 /// <since_tizen> 6 </since_tizen>
2124 public LayoutItem Layout
2132 // Do nothing if layout provided is already set on this View.
2133 if (value == _layout)
2138 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2139 layoutingDisabled = false;
2142 // If new layout being set already has a owner then that owner receives a replacement default layout.
2143 // First check if the layout to be set already has a owner.
2144 if (value?.Owner != null)
2146 // Previous owner of the layout gets a default layout as a replacement.
2147 value.Owner.Layout = new AbsoluteLayout();
2149 // Copy Margin and Padding to replacement LayoutGroup.
2150 value.Owner.Layout.Margin = value.Margin;
2151 value.Owner.Layout.Padding = value.Padding;
2154 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2155 // View if no replacement. Previously margin and padding values would have been moved from
2156 // the View to the layout.
2157 if (_layout != null ) // Existing layout
2161 // Existing layout being replaced so copy over margin and padding values.
2162 value.Margin = _layout.Margin;
2163 value.Padding = _layout.Padding;
2167 // Layout not being replaced so restore margin and padding to View.
2168 SetValue(MarginProperty, _layout.Margin);
2169 SetValue(PaddingProperty, _layout.Padding);
2170 NotifyPropertyChanged();
2175 // First Layout to be added to the View hence copy
2177 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2180 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2182 // If View already has a margin set then store it in Layout instead.
2183 value.Margin = Margin;
2184 SetValue(MarginProperty, new Extents(0,0,0,0));
2185 NotifyPropertyChanged();
2188 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2190 // If View already has a padding set then store it in Layout instead.
2191 value.Padding = Padding;
2192 SetValue(PaddingProperty, new Extents(0,0,0,0));
2193 NotifyPropertyChanged();
2198 // Remove existing layout from it's parent layout group.
2199 _layout?.Unparent();
2201 // Set layout to this view
2207 /// The weight of the View, used to share available space in a layout with siblings.
2209 /// <since_tizen> 6 </since_tizen>
2219 _layout?.RequestLayout();
2224 /// Whether to load the BackgroundImage synchronously.
2225 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2226 /// Note: For Normal Quad images only.
2228 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2229 [EditorBrowsable(EditorBrowsableState.Never)]
2230 public bool BackgroundImageSynchronosLoading
2234 return _backgroundImageSynchronosLoading;
2238 _backgroundImageSynchronosLoading = value;
2241 Background.Find(Visual.Property.Type)?.Get(out visualType);
2242 if (visualType == (int)Visual.Type.Image)
2244 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2247 if (bgUrl.Length != 0)
2249 PropertyMap bgMap = this.Background;
2250 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2256 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2257 [EditorBrowsable(EditorBrowsableState.Never)]
2258 public Vector2 UpdateSizeHint
2262 return (Vector2)GetValue(UpdateSizeHintProperty);
2266 SetValue(UpdateSizeHintProperty, value);
2267 NotifyPropertyChanged();
2271 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2272 [EditorBrowsable(EditorBrowsableState.Never)]
2273 public string[] TransitionNames
2277 return transitionNames;
2281 transitionNames = value;
2287 /// Enable/Disable ControlState propagation for children.
2288 /// It is false by default.
2289 /// If the View needs to share ControlState with descendants, please set it true.
2290 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2292 [EditorBrowsable(EditorBrowsableState.Never)]
2293 public bool EnableControlStatePropagation
2295 get => controlStatePropagation;
2298 controlStatePropagation = value;
2300 foreach (View child in Children)
2302 child.EnableControlStatePropagation = value;
2308 /// Get Style, it is abstract function and must be override.
2310 /// <since_tizen> 6 </since_tizen>
2311 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2312 // TODO: It should be deprecated. please use CreateViewStyle instead.
2313 [EditorBrowsable(EditorBrowsableState.Never)]
2314 protected virtual ViewStyle GetViewStyle()
2316 return CreateViewStyle();
2320 /// Create Style, it is abstract function and must be override.
2322 [EditorBrowsable(EditorBrowsableState.Never)]
2323 protected virtual ViewStyle CreateViewStyle()
2325 return new ViewStyle();
2329 /// Called after the View's ControlStates changed.
2331 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2332 [EditorBrowsable(EditorBrowsableState.Never)]
2333 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2337 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2339 var view = (View)bindable;
2340 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2342 defaultValueCreator: (bindable) =>
2344 var view = (View)bindable;
2345 return view.backgroundImageSelector;
2347 private TriggerableSelector<string> _backgroundImageSelector;
2348 private TriggerableSelector<string> backgroundImageSelector
2352 if (null == _backgroundImageSelector)
2354 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2356 return _backgroundImageSelector;
2359 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2361 var view = (View)bindable;
2362 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2364 defaultValueCreator: (bindable) =>
2366 var view = (View)bindable;
2367 return view.backgroundColorSelector;
2369 private TriggerableSelector<Color> _backgroundColorSelector;
2370 private TriggerableSelector<Color> backgroundColorSelector
2374 if (null == _backgroundColorSelector)
2376 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2378 return _backgroundColorSelector;
2382 internal static readonly BindableProperty ColorSelectorProperty = BindableProperty.Create("ColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2384 var view = (View)bindable;
2385 view.colorSelector.Clone((Selector<Color>)newValue);
2387 defaultValueCreator: (bindable) =>
2389 var view = (View)bindable;
2390 return view.colorSelector;
2393 private TriggerableSelector<Color> _colorSelector;
2394 private TriggerableSelector<Color> colorSelector
2398 if (null == _colorSelector)
2400 _colorSelector = new TriggerableSelector<Color>(this, ColorProperty);
2402 return _colorSelector;
2406 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2408 var view = (View)bindable;
2409 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2411 defaultValueCreator: (bindable) =>
2413 var view = (View)bindable;
2414 return view.backgroundImageBorderSelector;
2416 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2417 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2421 if (null == _backgroundImageBorderSelector)
2423 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2425 return _backgroundImageBorderSelector;
2428 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2430 var view = (View)bindable;
2431 view.opacitySelector.Clone((Selector<float?>)newValue);
2433 defaultValueCreator: (bindable) =>
2435 var view = (View)bindable;
2436 return view.opacitySelector;
2438 private TriggerableSelector<float?> _opacitySelector;
2439 private TriggerableSelector<float?> opacitySelector
2443 if (null == _opacitySelector)
2445 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2447 return _opacitySelector;
2451 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2452 [EditorBrowsable(EditorBrowsableState.Never)]
2453 public virtual void ApplyStyle(ViewStyle viewStyle)
2455 if (null == viewStyle)
2460 if (this.viewStyle == viewStyle)
2465 if (null != this.viewStyle)
2467 simpleBinding.Clear();
2470 this.viewStyle = viewStyle;
2472 Dictionary<string, BindableProperty> bindablePropertyOfView;
2473 Type viewType = GetType();
2475 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2476 Type styleType = viewStyle.GetType();
2478 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2479 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2481 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2483 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2485 BindableProperty viewProperty;
2486 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2488 if (null != viewProperty)
2490 object value = viewStyle.GetValue(keyValuePair.Value);
2494 SetValue(viewProperty, value);
2497 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2503 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2504 [EditorBrowsable(EditorBrowsableState.Never)]
2505 private BundledPipe simpleBinding = new BundledPipe();