2 * Copyright(c) 2021 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;
23 namespace Tizen.NUI.BaseComponents
26 /// View is the base class for all views.
28 /// <since_tizen> 3 </since_tizen>
29 public partial class View : Container, IResourcesProvider
31 private static HashSet<BindableProperty> positionPropertyGroup = new HashSet<BindableProperty>();
32 private static HashSet<BindableProperty> sizePropertyGroup = new HashSet<BindableProperty>();
33 private static HashSet<BindableProperty> scalePropertyGroup = new HashSet<BindableProperty>();
35 internal BackgroundExtraData backgroundExtraData;
37 private bool layoutSet = false;
38 private LayoutItem layout; // Exclusive layout assigned to this View.
40 // List of transitions paired with the condition that uses the transition.
41 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
42 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
43 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
44 private float weight = 0.0f; // Weighting of child View in a Layout
45 private bool backgroundImageSynchronosLoading = false;
46 private bool excludeLayouting = false;
47 private LayoutTransition layoutTransition;
48 private TransitionOptions transitionOptions = null;
49 private ThemeData themeData;
51 // List of constraints
52 private Constraint widthConstraint = null;
53 private Constraint heightConstraint = null;
56 RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
57 RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
58 RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
59 RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);
61 RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
62 RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
63 RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
64 RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);
66 RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
67 RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
68 RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
69 RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
73 /// Creates a new instance of a view.
75 /// <since_tizen> 3 </since_tizen>
76 public View() : this(Interop.View.New(), true)
78 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
82 [EditorBrowsable(EditorBrowsableState.Never)]
83 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
88 /// Create a new instance of a View with setting the status of shown or hidden.
90 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
91 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
92 [EditorBrowsable(EditorBrowsableState.Never)]
93 public View(bool shown) : this(Interop.View.New(), true)
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
110 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
112 InitializeStyle(viewStyle);
115 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
119 PositionUsesPivotPoint = false;
122 onWindowSendEventCallback = SendViewAddedEventToWindow;
123 this.OnWindowSignal().Connect(onWindowSendEventCallback);
131 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
133 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142 /// The event that is triggered when the View's ControlState is changed.
144 [EditorBrowsable(EditorBrowsableState.Never)]
145 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
147 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
151 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
153 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
154 [EditorBrowsable(EditorBrowsableState.Never)]
155 public bool LayoutSet
164 /// Flag to allow Layouting to be disabled for Views.
165 /// Once a View has a Layout set then any children added to Views from then on will receive
166 /// automatic Layouts.
168 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
169 [EditorBrowsable(EditorBrowsableState.Never)]
170 public static bool LayoutingDisabled { get; set; } = true;
173 /// Deprecate. Please do not use this.
174 /// The style instance applied to this view.
175 /// Note that please do not modify the ViewStyle.
176 /// Modifying ViewStyle will affect other views with same ViewStyle.
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 protected ViewStyle ViewStyle
183 if (themeData == null) themeData = new ThemeData();
185 if (themeData.viewStyle == null)
187 ApplyStyle(CreateViewStyle());
189 return themeData.viewStyle;
194 /// Get/Set the control state.
195 /// Note that the ControlState only available for the classes derived from Control.
196 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
197 /// please set <see cref="EnableControlState"/> to true.
199 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
200 [EditorBrowsable(EditorBrowsableState.Never)]
201 public ControlState ControlState
205 return themeData == null ? ControlState.Normal : themeData.controlStates;
209 if (ControlState == value)
214 var prevState = ControlState;
216 if (themeData == null) themeData = new ThemeData();
217 themeData.controlStates = value;
219 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
221 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
223 if (themeData.ControlStatePropagation)
225 foreach (View child in Children)
227 child.ControlState = value;
231 OnControlStateChanged(changeInfo);
233 ControlStateChangedEvent?.Invoke(this, changeInfo);
238 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
240 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
241 [EditorBrowsable(EditorBrowsableState.Never)]
242 public bool ExcludeLayouting
246 return excludeLayouting;
250 excludeLayouting = value;
251 if (Layout != null && Layout.SetPositionByLayout == value)
253 Layout.SetPositionByLayout = !value;
254 Layout.RequestLayout();
259 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
260 [EditorBrowsable(EditorBrowsableState.Never)]
261 public bool IsResourcesCreated
265 return Application.Current.IsResourcesCreated;
269 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
270 [EditorBrowsable(EditorBrowsableState.Never)]
271 public ResourceDictionary XamlResources
275 return Application.Current.XamlResources;
279 Application.Current.XamlResources = value;
284 /// The StyleName, type string.
285 /// The value indicates DALi style name defined in json theme file.
287 /// <since_tizen> 3 </since_tizen>
288 public string StyleName
292 return (string)GetValue(StyleNameProperty);
296 SetValue(StyleNameProperty, value);
297 NotifyPropertyChanged();
302 /// The KeyInputFocus, type bool.
304 [EditorBrowsable(EditorBrowsableState.Never)]
305 public bool KeyInputFocus
309 return (bool)GetValue(KeyInputFocusProperty);
313 SetValue(KeyInputFocusProperty, value);
314 NotifyPropertyChanged();
319 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
323 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
326 /// Animatable - This property can be animated using <c>Animation</c> class.
328 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
332 /// <since_tizen> 3 </since_tizen>
333 public Color BackgroundColor
337 Color temp = (Color)GetValue(BackgroundColorProperty);
338 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
342 SetValue(BackgroundColorProperty, value);
343 NotifyPropertyChanged();
348 /// The mutually exclusive with "backgroundColor" and "background" type Map.
350 /// <since_tizen> 3 </since_tizen>
351 public string BackgroundImage
355 return (string)GetValue(BackgroundImageProperty);
359 SetValue(BackgroundImageProperty, value);
360 NotifyPropertyChanged();
365 /// Get or set the border of background image.
367 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
368 [EditorBrowsable(EditorBrowsableState.Never)]
369 public Rectangle BackgroundImageBorder
373 return (Rectangle)GetValue(BackgroundImageBorderProperty);
377 SetValue(BackgroundImageBorderProperty, value);
378 NotifyPropertyChanged();
383 /// The background of view.
385 /// <since_tizen> 3 </since_tizen>
386 public Tizen.NUI.PropertyMap Background
390 return (PropertyMap)GetValue(BackgroundProperty);
394 SetValue(BackgroundProperty, value);
395 NotifyPropertyChanged();
400 /// Describes a shadow as an image for a View.
401 /// It is null by default.
404 /// Getter returns copied instance of current shadow.
407 /// The mutually exclusive with "BoxShadow".
411 /// Animatable - This property can be animated using <c>Animation</c> class.
412 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
414 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
416 /// Animatable sub-property : Offset.
419 [EditorBrowsable(EditorBrowsableState.Never)]
420 public ImageShadow ImageShadow
424 return (ImageShadow)GetValue(ImageShadowProperty);
428 SetValue(ImageShadowProperty, value);
429 NotifyPropertyChanged();
434 /// Describes a box shaped shadow drawing for a View.
435 /// It is null by default.
438 /// The mutually exclusive with "ImageShadow".
442 /// Animatable - This property can be animated using <c>Animation</c> class.
443 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
445 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
447 /// Animatable sub-property : Offset, Color, BlurRadius.
450 /// <since_tizen> 9 </since_tizen>
451 public Shadow BoxShadow
455 return (Shadow)GetValue(BoxShadowProperty);
459 SetValue(BoxShadowProperty, value);
460 NotifyPropertyChanged();
465 /// The radius for the rounded corners of the View.
466 /// This will rounds background and shadow edges.
467 /// The values in Vector4 are used in clockwise order from top-left to bottom-left : Vector4(top-left-corner, top-right-corner, bottom-right-corner, bottom-left-corner).
468 /// Each radius will clamp internally to the half of smaller of the view's width or height.
469 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
473 /// Animatable - This property can be animated using <c>Animation</c> class.
475 /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10));
479 /// <since_tizen> 9 </since_tizen>
480 public Vector4 CornerRadius
484 return (Vector4)GetValue(CornerRadiusProperty);
488 SetValue(CornerRadiusProperty, value);
489 NotifyPropertyChanged();
494 /// Whether the CornerRadius property value is relative (percentage [0.0f to 0.5f] of the view size) or absolute (in world units).
495 /// It is absolute by default.
496 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
498 /// <since_tizen> 9 </since_tizen>
499 public VisualTransformPolicyType CornerRadiusPolicy
501 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
502 set => SetValue(CornerRadiusPolicyProperty, value);
506 /// The width for the borderline of the View.
507 /// Note that, an image background may not have borderline if it uses a Border property.
511 /// Animatable - This property can be animated using <c>Animation</c> class.
513 /// animation.AnimateTo(view, "BorderlineWidth", 100.0f);
517 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
518 [EditorBrowsable(EditorBrowsableState.Never)]
519 public float BorderlineWidth
523 return (float)GetValue(BorderlineWidthProperty);
527 SetValue(BorderlineWidthProperty, value);
528 NotifyPropertyChanged();
533 /// The color for the borderline of the View.
534 /// It is Color.Black by default.
535 /// This color is affected by View Opacity.
539 /// Animatable - This property can be animated using <c>Animation</c> class.
541 /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a));
545 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
546 [EditorBrowsable(EditorBrowsableState.Never)]
547 public Color BorderlineColor
551 return (Color)GetValue(BorderlineColorProperty);
555 SetValue(BorderlineColorProperty, value);
556 NotifyPropertyChanged();
561 /// The Relative offset for the borderline of the View.
562 /// recommand [-1.0f to 1.0f] range.
563 /// If -1.0f, borderline draw inside of View.
564 /// If 1.0f, borderline draw outside of View.
565 /// If 0.0f, borderline draw half at inside and half at outside.
566 /// It is 0.0f by default.
570 /// Animatable - This property can be animated using <c>Animation</c> class.
572 /// animation.AnimateTo(view, "BorderlineOffset", -1.0f);
576 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
577 [EditorBrowsable(EditorBrowsableState.Never)]
578 public float BorderlineOffset
582 return (float)GetValue(BorderlineOffsetProperty);
586 SetValue(BorderlineOffsetProperty, value);
587 NotifyPropertyChanged();
592 /// The current state of the view.
594 /// <since_tizen> 3 </since_tizen>
599 return (States)GetValue(StateProperty);
603 SetValue(StateProperty, value);
604 NotifyPropertyChanged();
609 /// The current sub state of the view.
611 /// <since_tizen> 3 </since_tizen>
612 public States SubState
616 return (States)GetValue(SubStateProperty);
620 SetValue(SubStateProperty, value);
621 NotifyPropertyChanged();
626 /// Displays a tooltip
628 /// <since_tizen> 3 </since_tizen>
629 public Tizen.NUI.PropertyMap Tooltip
633 return (PropertyMap)GetValue(TooltipProperty);
637 SetValue(TooltipProperty, value);
638 NotifyPropertyChanged();
643 /// Displays a tooltip as a text.
645 /// <since_tizen> 3 </since_tizen>
646 public string TooltipText
650 using (var propertyValue = GetProperty(Property.TOOLTIP))
652 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
654 return retrivedValue;
656 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
657 return "error to get TooltipText";
662 var temp = new Tizen.NUI.PropertyValue(value);
663 SetProperty(View.Property.TOOLTIP, temp);
665 NotifyPropertyChanged();
670 /// The Child property of FlexContainer.<br />
671 /// The proportion of the free space in the container, the flex item will receive.<br />
672 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
674 /// <since_tizen> 3 </since_tizen>
675 [Obsolete("Deprecated in API8, will be removed in API10.")]
680 return (float)GetValue(FlexProperty);
684 SetValue(FlexProperty, value);
685 NotifyPropertyChanged();
690 /// The Child property of FlexContainer.<br />
691 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
693 /// <since_tizen> 3 </since_tizen>
694 [Obsolete("Deprecated in API8, will be removed in API10.")]
699 return (int)GetValue(AlignSelfProperty);
703 SetValue(AlignSelfProperty, value);
704 NotifyPropertyChanged();
709 /// The Child property of FlexContainer.<br />
710 /// The space around the flex item.<br />
713 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
715 /// <since_tizen> 3 </since_tizen>
716 [Obsolete("Deprecated in API8, will be removed in API10.")]
717 public Vector4 FlexMargin
721 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
722 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
726 SetValue(FlexMarginProperty, value);
727 NotifyPropertyChanged();
732 /// The top-left cell this child occupies, if not set, the first available cell is used.
735 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
736 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
738 /// <since_tizen> 3 </since_tizen>
739 public Vector2 CellIndex
743 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
744 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
748 SetValue(CellIndexProperty, value);
749 NotifyPropertyChanged();
754 /// The number of rows this child occupies, if not set, the default value is 1.
757 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
759 /// <since_tizen> 3 </since_tizen>
764 return (float)GetValue(RowSpanProperty);
768 SetValue(RowSpanProperty, value);
769 NotifyPropertyChanged();
774 /// The number of columns this child occupies, if not set, the default value is 1.
777 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
779 /// <since_tizen> 3 </since_tizen>
780 public float ColumnSpan
784 return (float)GetValue(ColumnSpanProperty);
788 SetValue(ColumnSpanProperty, value);
789 NotifyPropertyChanged();
794 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
797 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
799 /// <since_tizen> 3 </since_tizen>
800 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
804 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
808 SetValue(CellHorizontalAlignmentProperty, value);
809 NotifyPropertyChanged();
814 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
817 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
819 /// <since_tizen> 3 </since_tizen>
820 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
824 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
828 SetValue(CellVerticalAlignmentProperty, value);
829 NotifyPropertyChanged();
834 /// The left focusable view.<br />
835 /// This will return null if not set.<br />
836 /// This will also return null if the specified left focusable view is not on a window.<br />
838 /// <since_tizen> 3 </since_tizen>
839 public View LeftFocusableView
841 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
844 return (View)GetValue(LeftFocusableViewProperty);
848 SetValue(LeftFocusableViewProperty, value);
849 NotifyPropertyChanged();
854 /// The right focusable view.<br />
855 /// This will return null if not set.<br />
856 /// This will also return null if the specified right focusable view is not on a window.<br />
858 /// <since_tizen> 3 </since_tizen>
859 public View RightFocusableView
861 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
864 return (View)GetValue(RightFocusableViewProperty);
868 SetValue(RightFocusableViewProperty, value);
869 NotifyPropertyChanged();
874 /// The up focusable view.<br />
875 /// This will return null if not set.<br />
876 /// This will also return null if the specified up focusable view is not on a window.<br />
878 /// <since_tizen> 3 </since_tizen>
879 public View UpFocusableView
881 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
884 return (View)GetValue(UpFocusableViewProperty);
888 SetValue(UpFocusableViewProperty, value);
889 NotifyPropertyChanged();
894 /// The down focusable view.<br />
895 /// This will return null if not set.<br />
896 /// This will also return null if the specified down focusable view is not on a window.<br />
898 /// <since_tizen> 3 </since_tizen>
899 public View DownFocusableView
901 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
904 return (View)GetValue(DownFocusableViewProperty);
908 SetValue(DownFocusableViewProperty, value);
909 NotifyPropertyChanged();
914 /// Whether the view should be focusable by keyboard navigation.
916 /// <since_tizen> 3 </since_tizen>
917 public bool Focusable
921 SetValue(FocusableProperty, value);
922 NotifyPropertyChanged();
926 return (bool)GetValue(FocusableProperty);
931 /// Whether this view can focus by touch.
932 /// If Focusable is false, FocusableInTouch is disabled.
933 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
935 [EditorBrowsable(EditorBrowsableState.Never)]
936 public bool FocusableInTouch
940 SetValue(FocusableInTouchProperty, value);
941 NotifyPropertyChanged();
945 return (bool)GetValue(FocusableInTouchProperty);
950 /// Retrieves the position of the view.<br />
951 /// The coordinates are relative to the view's parent.<br />
953 /// <since_tizen> 3 </since_tizen>
954 public Position CurrentPosition
958 return GetCurrentPosition();
963 /// Sets the size of a view for the width and the height.<br />
964 /// Geometry can be scaled to fit within this area.<br />
965 /// This does not interfere with the view's scale factor.<br />
966 /// The views default depth is the minimum of width and height.<br />
969 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
970 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
972 /// <since_tizen> 3 </since_tizen>
977 Size2D temp = (Size2D)GetValue(Size2DProperty);
978 int width = temp.Width;
979 int height = temp.Height;
981 if (this.Layout == null)
983 if (width < 0) { width = 0; }
984 if (height < 0) { height = 0; }
987 return new Size2D(OnSize2DChanged, width, height);
991 SetValue(Size2DProperty, value);
993 NotifyPropertyChanged();
998 /// Retrieves the size of the view.<br />
999 /// The coordinates are relative to the view's parent.<br />
1001 /// <since_tizen> 3 </since_tizen>
1002 public Size2D CurrentSize
1006 return GetCurrentSize();
1011 /// Retrieves and sets the view's opacity.<br />
1015 /// Animatable - This property can be animated using <c>Animation</c> class.
1017 /// animation.AnimateTo(view, "Opacity", 0.5f);
1021 /// <since_tizen> 3 </since_tizen>
1022 public float Opacity
1026 return (float)GetValue(OpacityProperty);
1030 SetValue(OpacityProperty, value);
1031 NotifyPropertyChanged();
1036 /// Sets the position of the view for X and Y.<br />
1037 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1038 /// If the position inheritance is disabled, sets the world position.<br />
1041 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1042 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1044 /// <since_tizen> 3 </since_tizen>
1045 public Position2D Position2D
1049 Position2D temp = (Position2D)GetValue(Position2DProperty);
1050 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1054 SetValue(Position2DProperty, value);
1055 NotifyPropertyChanged();
1060 /// Retrieves the screen position of the view.<br />
1062 /// <since_tizen> 3 </since_tizen>
1063 public Vector2 ScreenPosition
1067 Vector2 temp = new Vector2(0.0f, 0.0f);
1068 var pValue = GetProperty(View.Property.ScreenPosition);
1076 /// Determines whether the pivot point should be used to determine the position of the view.
1077 /// This is false by default.
1079 /// <remarks>If false, then the top-left of the view is used for the position.
1080 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1082 /// <since_tizen> 3 </since_tizen>
1083 public bool PositionUsesPivotPoint
1087 return (bool)GetValue(PositionUsesPivotPointProperty);
1091 SetValue(PositionUsesPivotPointProperty, value);
1092 NotifyPropertyChanged();
1097 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1099 /// <since_tizen> 3 </since_tizen>
1100 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1102 "View view = new View(); " +
1103 "view.PivotPoint = PivotPoint.Center; " +
1104 "view.PositionUsesPivotPoint = true;" +
1105 " Deprecated in API5: Will be removed in API8")]
1106 [EditorBrowsable(EditorBrowsableState.Never)]
1107 public bool PositionUsesAnchorPoint
1112 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1113 pValue.Get(out temp);
1119 var temp = new Tizen.NUI.PropertyValue(value);
1120 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1122 NotifyPropertyChanged();
1127 /// Queries whether the view is connected to the stage.<br />
1128 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1130 /// <since_tizen> 3 </since_tizen>
1131 public bool IsOnWindow
1140 /// Gets the depth in the hierarchy for the view.
1142 /// <since_tizen> 3 </since_tizen>
1143 public int HierarchyDepth
1147 return GetHierarchyDepth();
1152 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1155 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1156 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1157 /// The values set by this property will likely change.
1159 /// <since_tizen> 3 </since_tizen>
1160 public int SiblingOrder
1164 return (int)GetValue(SiblingOrderProperty);
1168 SetValue(SiblingOrderProperty, value);
1170 LayoutGroup layout = Layout as LayoutGroup;
1171 layout?.ChangeLayoutSiblingOrder(value);
1173 NotifyPropertyChanged();
1178 /// Returns the natural size of the view.
1181 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1183 /// <since_tizen> 5 </since_tizen>
1184 public Vector3 NaturalSize
1188 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1195 /// Returns the natural size (Size2D) of the view.
1198 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1200 /// <since_tizen> 4 </since_tizen>
1201 public Size2D NaturalSize2D
1205 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1206 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1208 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1215 /// Gets or sets the origin of a view within its parent's area.<br />
1216 /// 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 />
1217 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1218 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1220 /// <pre>The view has been initialized.</pre>
1221 /// <since_tizen> 3 </since_tizen>
1222 public Position ParentOrigin
1226 Position tmp = (Position)GetValue(ParentOriginProperty);
1227 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1231 SetValue(ParentOriginProperty, value);
1232 NotifyPropertyChanged();
1237 /// Gets or sets the anchor-point of a view.<br />
1238 /// 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 />
1239 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1240 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1241 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1242 /// <pre>The view has been initialized.</pre>
1245 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1247 /// <since_tizen> 3 </since_tizen>
1248 public Position PivotPoint
1252 Position tmp = (Position)GetValue(PivotPointProperty);
1253 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1257 SetValue(PivotPointProperty, value);
1258 NotifyPropertyChanged();
1263 /// Gets or sets the size width of the view.
1267 /// Animatable - This property can be animated using <c>Animation</c> class.
1269 /// animation.AnimateTo(view, "SizeWidth", 500.0f);
1273 /// <since_tizen> 3 </since_tizen>
1274 public float SizeWidth
1278 return (float)GetValue(SizeWidthProperty);
1282 SetValue(SizeWidthProperty, value);
1283 NotifyPropertyChanged();
1288 /// Gets or sets the size height of the view.
1292 /// Animatable - This property can be animated using <c>Animation</c> class.
1295 /// animation.AnimateTo(view, "SizeHeight", 500.0f);
1298 /// <since_tizen> 3 </since_tizen>
1299 public float SizeHeight
1303 return (float)GetValue(SizeHeightProperty);
1307 SetValue(SizeHeightProperty, value);
1308 NotifyPropertyChanged();
1313 /// Gets or sets the position of the view.<br />
1314 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1315 /// If the position inheritance is disabled, sets the world position.<br />
1319 /// Animatable - This property can be animated using <c>Animation</c> class.
1321 /// animation.AnimateTo(view, "Position", new Position(50, 0));
1324 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1326 /// <since_tizen> 3 </since_tizen>
1327 public Position Position
1331 Position tmp = (Position)GetValue(PositionProperty);
1332 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1336 SetValue(PositionProperty, value);
1337 NotifyPropertyChanged();
1342 /// Gets or sets the position X of the view.
1346 /// Animatable - This property can be animated using <c>Animation</c> class.
1348 /// animation.AnimateTo(view, "PositionX", 50.0f);
1352 /// <since_tizen> 3 </since_tizen>
1353 public float PositionX
1357 return (float)GetValue(PositionXProperty);
1361 SetValue(PositionXProperty, value);
1362 NotifyPropertyChanged();
1367 /// Gets or sets the position Y of the view.
1371 /// Animatable - This property can be animated using <c>Animation</c> class.
1373 /// animation.AnimateTo(view, "PositionY", 50.0f);
1377 /// <since_tizen> 3 </since_tizen>
1378 public float PositionY
1382 return (float)GetValue(PositionYProperty);
1386 SetValue(PositionYProperty, value);
1387 NotifyPropertyChanged();
1392 /// Gets or sets the position Z of the view.
1396 /// Animatable - This property can be animated using <c>Animation</c> class.
1398 /// animation.AnimateTo(view, "PositionZ", 50.0f);
1402 /// <since_tizen> 3 </since_tizen>
1403 public float PositionZ
1407 return (float)GetValue(PositionZProperty);
1411 SetValue(PositionZProperty, value);
1412 NotifyPropertyChanged();
1417 /// Gets or sets the world position of the view.
1419 /// <since_tizen> 3 </since_tizen>
1420 public Vector3 WorldPosition
1424 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1425 var pValue = GetProperty(View.Property.WorldPosition);
1433 /// Gets or sets the orientation of the view.<br />
1434 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1438 /// This is an asynchronous method.
1441 /// Animatable - This property can be animated using <c>Animation</c> class.
1443 /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis));
1447 /// <since_tizen> 3 </since_tizen>
1448 public Rotation Orientation
1452 return (Rotation)GetValue(OrientationProperty);
1456 SetValue(OrientationProperty, value);
1457 NotifyPropertyChanged();
1462 /// Gets or sets the world orientation of the view.<br />
1464 /// <since_tizen> 3 </since_tizen>
1465 public Rotation WorldOrientation
1469 Rotation temp = new Rotation();
1470 var pValue = GetProperty(View.Property.WorldOrientation);
1478 /// Gets or sets the scale factor applied to the view.<br />
1482 /// Animatable - This property can be animated using <c>Animation</c> class.
1484 /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f));
1487 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1489 /// <since_tizen> 3 </since_tizen>
1490 public Vector3 Scale
1494 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1495 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1499 SetValue(ScaleProperty, value);
1500 NotifyPropertyChanged();
1505 /// Gets or sets the scale X factor applied to the view.
1509 /// Animatable - This property can be animated using <c>Animation</c> class.
1511 /// animation.AnimateTo(view, "ScaleX", 1.5f);
1515 /// <since_tizen> 3 </since_tizen>
1520 return (float)GetValue(ScaleXProperty);
1524 SetValue(ScaleXProperty, value);
1525 NotifyPropertyChanged();
1530 /// Gets or sets the scale Y factor applied to the view.
1534 /// Animatable - This property can be animated using <c>Animation</c> class.
1536 /// animation.AnimateTo(view, "ScaleY", 1.5f);
1540 /// <since_tizen> 3 </since_tizen>
1545 return (float)GetValue(ScaleYProperty);
1549 SetValue(ScaleYProperty, value);
1550 NotifyPropertyChanged();
1555 /// Gets or sets the scale Z factor applied to the view.
1559 /// Animatable - This property can be animated using <c>Animation</c> class.
1561 /// animation.AnimateTo(view, "ScaleZ", 1.5f);
1565 /// <since_tizen> 3 </since_tizen>
1570 return (float)GetValue(ScaleZProperty);
1574 SetValue(ScaleZProperty, value);
1575 NotifyPropertyChanged();
1580 /// Gets the world scale of the view.
1582 /// <since_tizen> 3 </since_tizen>
1583 public Vector3 WorldScale
1587 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1588 var pValue = GetProperty(View.Property.WorldScale);
1596 /// Retrieves the visibility flag of the view.
1600 /// If the view is not visible, then the view and its children will not be rendered.
1601 /// 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.
1604 /// Animatable - This property can be animated using <c>Animation</c> class.
1606 /// animation.AnimateTo(view, "Visibility", false);
1610 /// <since_tizen> 3 </since_tizen>
1611 public bool Visibility
1616 var pValue = GetProperty(View.Property.VISIBLE);
1617 pValue.Get(out temp);
1624 /// Gets the view's world color.
1626 /// <since_tizen> 3 </since_tizen>
1627 public Vector4 WorldColor
1631 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1632 var pValue = GetProperty(View.Property.WorldColor);
1640 /// Gets or sets the view's name.
1642 /// <since_tizen> 3 </since_tizen>
1647 return (string)GetValue(NameProperty);
1651 SetValue(NameProperty, value);
1652 NotifyPropertyChanged();
1657 /// Get the number of children held by the view.
1659 /// <since_tizen> 3 </since_tizen>
1660 public new uint ChildCount
1664 return Convert.ToUInt32(Children.Count);
1669 /// Gets the view's ID.
1672 /// <since_tizen> 3 </since_tizen>
1682 /// Gets or sets the status of whether the view should emit touch or hover signals.
1683 /// If a View is made insensitive, then the View and its children are not hittable.
1685 /// <since_tizen> 3 </since_tizen>
1686 public bool Sensitive
1690 return (bool)GetValue(SensitiveProperty);
1694 SetValue(SensitiveProperty, value);
1695 NotifyPropertyChanged();
1700 /// 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.
1702 /// <since_tizen> 3 </since_tizen>
1703 public bool LeaveRequired
1707 return (bool)GetValue(LeaveRequiredProperty);
1711 SetValue(LeaveRequiredProperty, value);
1712 NotifyPropertyChanged();
1717 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1719 /// <since_tizen> 3 </since_tizen>
1720 public bool InheritOrientation
1724 return (bool)GetValue(InheritOrientationProperty);
1728 SetValue(InheritOrientationProperty, value);
1729 NotifyPropertyChanged();
1734 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1736 /// <since_tizen> 3 </since_tizen>
1737 public bool InheritScale
1741 return (bool)GetValue(InheritScaleProperty);
1745 SetValue(InheritScaleProperty, value);
1746 NotifyPropertyChanged();
1751 /// Gets or sets the status of how the view and its children should be drawn.<br />
1752 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1753 /// 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 />
1754 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1755 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1756 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1758 /// <since_tizen> 3 </since_tizen>
1759 public DrawModeType DrawMode
1763 return (DrawModeType)GetValue(DrawModeProperty);
1767 SetValue(DrawModeProperty, value);
1768 NotifyPropertyChanged();
1773 /// Gets or sets the relative to parent size factor of the view.<br />
1774 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1775 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1778 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1780 /// <since_tizen> 3 </since_tizen>
1781 public Vector3 SizeModeFactor
1785 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1786 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1790 SetValue(SizeModeFactorProperty, value);
1791 NotifyPropertyChanged();
1796 /// Gets or sets the width resize policy to be used.
1798 /// <since_tizen> 3 </since_tizen>
1799 public ResizePolicyType WidthResizePolicy
1803 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1807 SetValue(WidthResizePolicyProperty, value);
1808 NotifyPropertyChanged();
1813 /// Gets or sets the height resize policy to be used.
1815 /// <since_tizen> 3 </since_tizen>
1816 public ResizePolicyType HeightResizePolicy
1820 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1824 SetValue(HeightResizePolicyProperty, value);
1825 NotifyPropertyChanged();
1830 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1831 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1833 /// <since_tizen> 3 </since_tizen>
1834 public SizeScalePolicyType SizeScalePolicy
1838 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1842 SetValue(SizeScalePolicyProperty, value);
1843 NotifyPropertyChanged();
1848 /// Gets or sets the status of whether the width size is dependent on the height size.
1850 /// <since_tizen> 3 </since_tizen>
1851 public bool WidthForHeight
1855 return (bool)GetValue(WidthForHeightProperty);
1859 SetValue(WidthForHeightProperty, value);
1860 NotifyPropertyChanged();
1865 /// Gets or sets the status of whether the height size is dependent on the width size.
1867 /// <since_tizen> 3 </since_tizen>
1868 public bool HeightForWidth
1872 return (bool)GetValue(HeightForWidthProperty);
1876 SetValue(HeightForWidthProperty, value);
1877 NotifyPropertyChanged();
1882 /// Gets or sets the padding for use in layout.
1885 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1887 /// <since_tizen> 5 </since_tizen>
1888 public Extents Padding
1892 // If View has a Layout then padding in stored in the base Layout class
1895 return Layout.Padding;
1899 Extents temp = (Extents)GetValue(PaddingProperty);
1900 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1902 // Two return points to prevent creating a zeroed Extent native object before assignment
1906 Extents padding = value;
1909 // Layout set so store Padding in LayoutItem instead of in View.
1910 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1911 // the position and sizes measure in the Layouting.
1912 Layout.Padding = value;
1913 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1914 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1915 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1917 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1921 SetValue(PaddingProperty, padding);
1922 NotifyPropertyChanged();
1927 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1929 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1931 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1933 /// <since_tizen> 3 </since_tizen>
1934 public Size2D MinimumSize
1938 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1939 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1945 throw new ArgumentNullException(nameof(value));
1949 // Note: it only works if minimum size is >= than natural size.
1950 // To force the size it should be done through the width&height spec or Size2D.
1951 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1952 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1953 layout.RequestLayout();
1955 SetValue(MinimumSizeProperty, value);
1956 NotifyPropertyChanged();
1961 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1964 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1966 /// <since_tizen> 3 </since_tizen>
1967 public Size2D MaximumSize
1971 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1972 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1976 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1977 // MATCH_PARENT spec + parent container size can be used to limit
1980 layout.RequestLayout();
1982 SetValue(MaximumSizeProperty, value);
1983 NotifyPropertyChanged();
1988 /// Gets or sets whether a child view inherits it's parent's position.<br />
1989 /// Default is to inherit.<br />
1990 /// 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 />
1992 /// <since_tizen> 3 </since_tizen>
1993 public bool InheritPosition
1997 return (bool)GetValue(InheritPositionProperty);
2001 SetValue(InheritPositionProperty, value);
2002 NotifyPropertyChanged();
2007 /// Gets or sets the clipping behavior (mode) of it's children.
2009 /// <since_tizen> 3 </since_tizen>
2010 public ClippingModeType ClippingMode
2014 return (ClippingModeType)GetValue(ClippingModeProperty);
2018 SetValue(ClippingModeProperty, value);
2019 NotifyPropertyChanged();
2024 /// Gets the number of renderers held by the view.
2026 /// <since_tizen> 3 </since_tizen>
2027 public uint RendererCount
2031 return GetRendererCount();
2036 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2039 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2041 /// <since_tizen> 3 </since_tizen>
2042 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2044 "View view = new View(); " +
2045 "view.PivotPoint = PivotPoint.Center; " +
2046 "view.PositionUsesPivotPoint = true;")]
2047 [EditorBrowsable(EditorBrowsableState.Never)]
2048 public Position AnchorPoint
2052 Position temp = new Position(0.0f, 0.0f, 0.0f);
2053 var pValue = GetProperty(View.Property.AnchorPoint);
2056 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2062 var temp = new Tizen.NUI.PropertyValue(value);
2063 SetProperty(View.Property.AnchorPoint, temp);
2065 NotifyPropertyChanged();
2070 /// Sets the size of a view for the width, the height and the depth.<br />
2071 /// Geometry can be scaled to fit within this area.<br />
2072 /// This does not interfere with the view's scale factor.<br />
2073 /// The views default depth is the minimum of width and height.<br />
2077 /// Animatable - This property can be animated using <c>Animation</c> class.
2079 /// animation.AnimateTo(view, "Size", new Size(100, 100));
2082 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2084 /// <since_tizen> 5 </since_tizen>
2089 Size tmp = (Size)GetValue(SizeProperty);
2090 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2094 SetValue(SizeProperty, value);
2095 NotifyPropertyChanged();
2100 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2102 /// <since_tizen> 3 </since_tizen>
2103 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2105 "Container parent = view.GetParent(); " +
2106 "View view = parent as View;")]
2107 [EditorBrowsable(EditorBrowsableState.Never)]
2108 public new View Parent
2113 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2114 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2115 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2117 if (basehandle is Layer layer)
2119 ret = new View(Layer.getCPtr(layer).Handle, false);
2120 NUILog.Error("This Parent property is deprecated, should do not be used");
2124 ret = basehandle as View;
2127 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2128 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2136 /// Gets/Sets whether inherit parent's the layout Direction.
2138 /// <since_tizen> 4 </since_tizen>
2139 public bool InheritLayoutDirection
2143 return (bool)GetValue(InheritLayoutDirectionProperty);
2147 SetValue(InheritLayoutDirectionProperty, value);
2148 NotifyPropertyChanged();
2153 /// Gets/Sets the layout Direction.
2155 /// <since_tizen> 4 </since_tizen>
2156 public ViewLayoutDirectionType LayoutDirection
2160 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2164 SetValue(LayoutDirectionProperty, value);
2165 NotifyPropertyChanged();
2166 layout?.RequestLayout();
2171 /// Gets or sets the Margin for use in layout.
2174 /// Margin property is supported by Layout algorithms and containers.
2175 /// Please Set Layout if you want to use Margin property.
2176 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2178 /// <since_tizen> 4 </since_tizen>
2179 public Extents Margin
2183 // If View has a Layout then margin is stored in Layout.
2186 return Layout.Margin;
2190 // If Layout not set then return margin stored in View.
2191 Extents temp = (Extents)GetValue(MarginProperty);
2192 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2194 // Two return points to prevent creating a zeroed Extent native object before assignment
2200 // Layout set so store Margin in LayoutItem instead of View.
2201 // If View stores the Margin too then the Legacy Size Negotiation will
2202 // overwrite the position and size values measured in the Layouting.
2203 Layout.Margin = value;
2204 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2205 layout?.RequestLayout();
2209 SetValue(MarginProperty, value);
2211 NotifyPropertyChanged();
2212 layout?.RequestLayout();
2217 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2221 /// // matchParentView matches its size to its parent size.
2222 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2223 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2225 /// // wrapContentView wraps its children with their desired size.
2226 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2227 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2229 /// // exactSizeView shows itself with an exact size.
2230 /// exactSizeView.WidthSpecification = 100;
2231 /// exactSizeView.HeightSpecification = 100;
2234 /// <since_tizen> 6 </since_tizen>
2235 public int WidthSpecification
2243 if (value == widthPolicy)
2246 widthPolicy = value;
2247 if (widthPolicy >= 0)
2249 if (heightPolicy >= 0) // Policy an exact value
2251 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2252 Size2D = new Size2D(widthPolicy, heightPolicy);
2255 layout?.RequestLayout();
2260 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2264 /// // matchParentView matches its size to its parent size.
2265 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2266 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2268 /// // wrapContentView wraps its children with their desired size.
2269 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2270 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2272 /// // exactSizeView shows itself with an exact size.
2273 /// exactSizeView.WidthSpecification = 100;
2274 /// exactSizeView.HeightSpecification = 100;
2277 /// <since_tizen> 6 </since_tizen>
2278 public int HeightSpecification
2282 return heightPolicy;
2286 if (value == heightPolicy)
2289 heightPolicy = value;
2290 if (heightPolicy >= 0)
2292 if (widthPolicy >= 0) // Policy an exact value
2294 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2295 Size2D = new Size2D(widthPolicy, heightPolicy);
2298 layout?.RequestLayout();
2303 /// Gets the List of transitions for this View.
2305 /// <since_tizen> 6 </since_tizen>
2306 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2310 if (layoutTransitions == null)
2312 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2314 return layoutTransitions;
2319 /// Sets a layout transitions for this View.
2321 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2323 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2325 /// <since_tizen> 6 </since_tizen>
2326 public LayoutTransition LayoutTransition
2330 return layoutTransition;
2336 throw new global::System.ArgumentNullException(nameof(value));
2338 if (layoutTransitions == null)
2340 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2343 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2345 AttachTransitionsToChildren(value);
2347 layoutTransition = value;
2352 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2355 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2357 /// <since_tizen> 4 </since_tizen>
2358 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2359 [EditorBrowsable(EditorBrowsableState.Never)]
2360 public Extents PaddingEX
2364 Extents temp = new Extents(0, 0, 0, 0);
2365 var pValue = GetProperty(View.Property.PADDING);
2368 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2374 var temp = new Tizen.NUI.PropertyValue(value);
2375 SetProperty(View.Property.PADDING, temp);
2377 NotifyPropertyChanged();
2378 layout?.RequestLayout();
2383 /// The Color of View. This is an RGBA value.
2387 /// Animatable - This property can be animated using <c>Animation</c> class.
2389 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2391 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2392 [EditorBrowsable(EditorBrowsableState.Never)]
2397 Color temp = (Color)GetValue(ColorProperty);
2398 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2402 SetValue(ColorProperty, value);
2403 NotifyPropertyChanged();
2408 /// Set the layout on this View. Replaces any existing Layout.
2411 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2413 /// <since_tizen> 6 </since_tizen>
2414 public LayoutItem Layout
2422 // Do nothing if layout provided is already set on this View.
2423 if (value == layout)
2428 LayoutingDisabled = false;
2431 // If new layout being set already has a owner then that owner receives a replacement default layout.
2432 // First check if the layout to be set already has a owner.
2433 if (value?.Owner != null)
2435 // Previous owner of the layout gets a default layout as a replacement.
2436 value.Owner.Layout = new AbsoluteLayout();
2438 // Copy Margin and Padding to replacement LayoutGroup.
2439 if (value.Owner.Layout != null)
2441 value.Owner.Layout.Margin = value.Margin;
2442 value.Owner.Layout.Padding = value.Padding;
2446 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2447 // View if no replacement. Previously margin and padding values would have been moved from
2448 // the View to the layout.
2449 if (layout != null) // Existing layout
2453 // Existing layout being replaced so copy over margin and padding values.
2454 value.Margin = layout.Margin;
2455 value.Padding = layout.Padding;
2459 // Layout not being replaced so restore margin and padding to View.
2460 SetValue(MarginProperty, layout.Margin);
2461 SetValue(PaddingProperty, layout.Padding);
2462 NotifyPropertyChanged();
2467 // First Layout to be added to the View hence copy
2469 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2472 Extents margin = Margin;
2473 Extents padding = Padding;
2474 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2476 // If View already has a margin set then store it in Layout instead.
2477 value.Margin = margin;
2478 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2479 NotifyPropertyChanged();
2482 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2484 // If View already has a padding set then store it in Layout instead.
2485 value.Padding = padding;
2487 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2488 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2489 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2491 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2492 NotifyPropertyChanged();
2498 // Remove existing layout from it's parent layout group.
2501 value.SetPositionByLayout = !excludeLayouting;
2503 // Set layout to this view
2509 /// The weight of the View, used to share available space in a layout with siblings.
2511 /// <since_tizen> 6 </since_tizen>
2521 layout?.RequestLayout();
2526 /// Whether to load the BackgroundImage synchronously.
2527 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2528 /// Note: For Normal Quad images only.
2530 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2531 [EditorBrowsable(EditorBrowsableState.Never)]
2532 public bool BackgroundImageSynchronosLoading
2536 return backgroundImageSynchronosLoading;
2540 backgroundImageSynchronosLoading = value;
2542 string bgUrl = null;
2543 var pValue = Background.Find(ImageVisualProperty.URL);
2544 pValue?.Get(out bgUrl);
2547 if (!string.IsNullOrEmpty(bgUrl))
2549 PropertyMap bgMap = this.Background;
2550 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2551 bgMap.Add("synchronousLoading", temp);
2558 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2559 [EditorBrowsable(EditorBrowsableState.Never)]
2560 public Vector2 UpdateSizeHint
2564 return (Vector2)GetValue(UpdateSizeHintProperty);
2568 SetValue(UpdateSizeHintProperty, value);
2569 NotifyPropertyChanged();
2574 /// Enable/Disable ControlState propagation for children.
2575 /// It is false by default.
2576 /// If the View needs to share ControlState with descendants, please set it true.
2577 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2579 [EditorBrowsable(EditorBrowsableState.Never)]
2580 public bool EnableControlStatePropagation
2582 get => themeData?.ControlStatePropagation ?? false;
2585 if (EnableControlStatePropagation == value) return;
2587 if (themeData == null) themeData = new ThemeData();
2589 themeData.ControlStatePropagation = value;
2591 foreach (View child in Children)
2593 child.EnableControlStatePropagation = value;
2599 /// By default, it is false in View, true in Control.
2600 /// Note that if the value is true, the View will be a touch receptor.
2602 [EditorBrowsable(EditorBrowsableState.Never)]
2603 public bool EnableControlState
2607 return (bool)GetValue(EnableControlStateProperty);
2611 SetValue(EnableControlStateProperty, value);
2616 /// Whether the actor grab all touches even if touch leaves its boundary.
2618 /// <returns>true, if it grab all touch after start</returns>
2619 [EditorBrowsable(EditorBrowsableState.Never)]
2620 public bool GrabTouchAfterLeave
2625 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2626 pValue.Get(out temp);
2632 var temp = new Tizen.NUI.PropertyValue(value);
2633 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2635 NotifyPropertyChanged();
2640 /// Determines which blend equation will be used to render renderers of this actor.
2642 /// <returns>blend equation enum currently assigned</returns>
2643 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2644 [EditorBrowsable(EditorBrowsableState.Never)]
2645 public BlendEquationType BlendEquation
2650 var pValue = GetProperty(View.Property.BlendEquation);
2651 pValue.Get(out temp);
2653 return (BlendEquationType)temp;
2657 var temp = new Tizen.NUI.PropertyValue((int)value);
2658 SetProperty(View.Property.BlendEquation, temp);
2660 NotifyPropertyChanged();
2665 /// If the value is true, the View will change its style as the theme changes.
2666 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
2668 /// <since_tizen> 9 </since_tizen>
2669 public bool ThemeChangeSensitive
2671 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2672 set => SetValue(ThemeChangeSensitiveProperty, value);
2676 /// Create Style, it is abstract function and must be override.
2678 [EditorBrowsable(EditorBrowsableState.Never)]
2679 protected virtual ViewStyle CreateViewStyle()
2681 return new ViewStyle();
2685 /// Called after the View's ControlStates changed.
2687 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2688 [EditorBrowsable(EditorBrowsableState.Never)]
2689 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2695 [EditorBrowsable(EditorBrowsableState.Never)]
2696 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2698 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
2699 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
2703 /// Apply style instance to the view.
2704 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2706 /// <since_tizen> 9 </since_tizen>
2707 public virtual void ApplyStyle(ViewStyle viewStyle)
2709 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
2711 if (themeData == null) themeData = new ThemeData();
2713 themeData.viewStyle = viewStyle;
2715 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2721 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2723 if (bindablePropertyOfView == null)
2728 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2729 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2731 foreach (var sourceProperty in dirtyStyleProperties)
2733 var sourceValue = viewStyle.GetValue(sourceProperty);
2735 if (sourceValue == null)
2740 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2742 if (destinationProperty != null)
2744 SetValue(destinationProperty, sourceValue);
2750 /// Get whether the View is culled or not.
2751 /// True means that the View is out of the view frustum.
2754 /// Hidden-API (Inhouse-API).
2756 [EditorBrowsable(EditorBrowsableState.Never)]
2762 var pValue = GetProperty(View.Property.Culled);
2763 pValue.Get(out temp);
2770 /// Set or Get TransitionOptions for the page transition.
2771 /// This property is used to define how this view will be transitioned during Page switching.
2773 /// <since_tizen> 9 </since_tizen>
2774 public TransitionOptions TransitionOptions
2778 transitionOptions = value;
2782 return transitionOptions;