2 * Copyright(c) 2022 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>();
34 private static bool defaultGrabTouchAfterLeave = false;
35 private static bool defaultAllowOnlyOwnTouch = false;
37 internal BackgroundExtraData backgroundExtraData;
39 private bool layoutSet = false;
40 private LayoutItem layout; // Exclusive layout assigned to this View.
42 // List of transitions paired with the condition that uses the transition.
43 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
44 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
45 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
46 private float weight = 0.0f; // Weighting of child View in a Layout
47 private bool backgroundImageSynchronousLoading = false;
48 private bool excludeLayouting = false;
49 private LayoutTransition layoutTransition;
50 private TransitionOptions transitionOptions = null;
51 private ThemeData themeData;
52 private bool isThemeChanged = false;
54 // List of constraints
55 private Constraint widthConstraint = null;
56 private Constraint heightConstraint = null;
58 private Size2D internalMaximumSize = null;
59 private Size2D internalMinimumSize = null;
60 private Extents internalMargin = null;
61 private Extents internalPadding = null;
62 private Vector3 internalSizeModeFactor = null;
63 private Vector2 internalCellIndex = null;
64 private Color internalBackgroundColor = null;
65 private Color internalColor = null;
66 private Position internalPivotPoint = null;
67 private Position internalPosition = null;
68 private Position2D internalPosition2D = null;
69 private Vector3 internalScale = null;
70 private Size internalSize = null;
71 private Size2D internalSize2D = null;
72 private int layoutCount = 0;
73 private ControlState propagatableControlStates = ControlState.All;
75 private string internalName = string.Empty;
76 private Position internalCurrentParentOrigin = null;
77 private Position internalCurrentAnchorPoint = null;
78 private Vector3 internalTargetSize = null;
79 private Size2D internalCurrentSize = null;
80 private Position internalCurrentPosition = null;
81 private Vector3 internalCurrentWorldPosition = null;
82 private Vector3 internalCurrentScale = null;
83 private Vector3 internalCurrentWorldScale = null;
84 private Vector4 internalCurrentColor = null;
85 private Vector4 internalCurrentWorldColor = null;
86 private Vector2 internalCurrentScreenPosition = null;
88 private static int aliveCount = 0;
92 if (NUIApplication.IsUsingXaml)
95 CreateBindableProperties();
97 BackgroundColorProperty = BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(View), null,
98 propertyChanged: SetInternalBackgroundColorProperty, defaultValueCreator: GetInternalBackgroundColorProperty);
100 ColorProperty = BindableProperty.Create(nameof(Color), typeof(Color), typeof(View), null,
101 propertyChanged: SetInternalColorProperty, defaultValueCreator: GetInternalColorProperty);
103 ColorRedProperty = BindableProperty.Create(nameof(ColorRed), typeof(float), typeof(View), default(float),
104 propertyChanged: SetInternalColorRedProperty, defaultValueCreator: GetInternalColorRedProperty);
106 ColorGreenProperty = BindableProperty.Create(nameof(ColorGreen), typeof(float), typeof(View), default(float),
107 propertyChanged: SetInternalColorGreenProperty, defaultValueCreator: GetInternalColorGreenProperty);
109 ColorBlueProperty = BindableProperty.Create(nameof(ColorBlue), typeof(float), typeof(View), default(float),
110 propertyChanged: SetInternalColorBlueProperty, defaultValueCreator: GetInternalColorBlueProperty);
112 CellIndexProperty = BindableProperty.Create(nameof(CellIndex), typeof(Vector2), typeof(View), null,
113 propertyChanged: SetInternalCellIndexProperty, defaultValueCreator: GetInternalCellIndexProperty);
115 Size2DProperty = BindableProperty.Create(nameof(Size2D), typeof(Size2D), typeof(View), null,
116 propertyChanged: SetInternalSize2DProperty, defaultValueCreator: GetInternalSize2DProperty);
118 Position2DProperty = BindableProperty.Create(nameof(Position2D), typeof(Position2D), typeof(View), null,
119 propertyChanged: SetInternalPosition2DProperty, defaultValueCreator: GetInternalPosition2DProperty);
121 ParentOriginProperty = BindableProperty.Create(nameof(ParentOrigin), typeof(Position), typeof(View), null,
122 propertyChanged: SetInternalParentOriginProperty, defaultValueCreator: GetInternalParentOriginProperty);
124 PivotPointProperty = BindableProperty.Create(nameof(PivotPoint), typeof(Position), typeof(View), null,
125 propertyChanged: SetInternalPivotPointProperty, defaultValueCreator: GetInternalPivotPointProperty);
127 SizeWidthProperty = BindableProperty.Create(nameof(SizeWidth), typeof(float), typeof(View), default(float),
128 propertyChanged: SetInternalSizeWidthProperty, defaultValueCreator: GetInternalSizeWidthProperty);
130 SizeHeightProperty = BindableProperty.Create(nameof(SizeHeight), typeof(float), typeof(View), default(float),
131 propertyChanged: SetInternalSizeHeightProperty, defaultValueCreator: GetInternalSizeHeightProperty);
133 PositionProperty = BindableProperty.Create(nameof(Position), typeof(Position), typeof(View), null,
134 propertyChanged: SetInternalPositionProperty, defaultValueCreator: GetInternalPositionProperty);
136 PositionXProperty = BindableProperty.Create(nameof(PositionX), typeof(float), typeof(View), default(float),
137 propertyChanged: SetInternalPositionXProperty, defaultValueCreator: GetInternalPositionXProperty);
139 PositionYProperty = BindableProperty.Create(nameof(PositionY), typeof(float), typeof(View), default(float),
140 propertyChanged: SetInternalPositionYProperty, defaultValueCreator: GetInternalPositionYProperty);
142 PositionZProperty = BindableProperty.Create(nameof(PositionZ), typeof(float), typeof(View), default(float),
143 propertyChanged: SetInternalPositionZProperty, defaultValueCreator: GetInternalPositionZProperty);
145 ScaleProperty = BindableProperty.Create(nameof(Scale), typeof(Vector3), typeof(View), null,
146 propertyChanged: SetInternalScaleProperty, defaultValueCreator: GetInternalScaleProperty);
148 ScaleXProperty = BindableProperty.Create(nameof(ScaleX), typeof(float), typeof(View), default(float),
149 propertyChanged: SetInternalScaleXProperty, defaultValueCreator: GetInternalScaleXProperty);
151 ScaleYProperty = BindableProperty.Create(nameof(ScaleY), typeof(float), typeof(View), default(float),
152 propertyChanged: SetInternalScaleYProperty, defaultValueCreator: GetInternalScaleYProperty);
154 ScaleZProperty = BindableProperty.Create(nameof(ScaleZ), typeof(float), typeof(View), default(float),
155 propertyChanged: SetInternalScaleZProperty, defaultValueCreator: GetInternalScaleZProperty);
157 NameProperty = BindableProperty.Create(nameof(Name), typeof(string), typeof(View), string.Empty,
158 propertyChanged: SetInternalNameProperty, defaultValueCreator: GetInternalNameProperty);
160 SizeModeFactorProperty = BindableProperty.Create(nameof(SizeModeFactor), typeof(Vector3), typeof(View), null,
161 propertyChanged: SetInternalSizeModeFactorProperty, defaultValueCreator: GetInternalSizeModeFactorProperty);
163 PaddingProperty = BindableProperty.Create(nameof(Padding), typeof(Extents), typeof(View), null,
164 propertyChanged: SetInternalPaddingProperty, defaultValueCreator: GetInternalPaddingProperty);
166 SizeProperty = BindableProperty.Create(nameof(Size), typeof(Size), typeof(View), null,
167 propertyChanged: SetInternalSizeProperty, defaultValueCreator: GetInternalSizeProperty);
169 MinimumSizeProperty = BindableProperty.Create(nameof(MinimumSize), typeof(Size2D), typeof(View), null,
170 propertyChanged: SetInternalMinimumSizeProperty, defaultValueCreator: GetInternalMinimumSizeProperty);
172 MaximumSizeProperty = BindableProperty.Create(nameof(MaximumSize), typeof(Size2D), typeof(View), null,
173 propertyChanged: SetInternalMaximumSizeProperty, defaultValueCreator: GetInternalMaximumSizeProperty);
175 MarginProperty = BindableProperty.Create(nameof(Margin), typeof(Extents), typeof(View), null,
176 propertyChanged: SetInternalMarginProperty, defaultValueCreator: GetInternalMarginProperty);
178 AnchorPointProperty = BindableProperty.Create(nameof(AnchorPoint), typeof(Tizen.NUI.Position), typeof(View), null,
179 propertyChanged: SetInternalAnchorPointProperty, defaultValueCreator: GetInternalAnchorPointProperty);
182 RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
183 RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
184 RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
185 RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);
187 RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
188 RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
189 RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
190 RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);
192 RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
193 RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
194 RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
195 RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
198 RegisterAccessibilityDelegate();
201 static internal new void Preload()
205 if (NUIApplication.IsUsingXaml)
207 // Do nothing. Just call for load static values.
208 var temporalPositionPropertyGroup = positionPropertyGroup;
209 var temporalSizePropertyGroup = sizePropertyGroup;
210 var temporalScalePropertyGroup = scalePropertyGroup;
215 /// Accessibility mode for controlling View's Accessible implementation.
216 /// It is only relevant when deriving custom controls from View directly,
217 /// as classes derived from CustomView (or any of its subclasses) get the
218 /// Custom mode by default.
220 [EditorBrowsable(EditorBrowsableState.Never)]
221 public enum ViewAccessibilityMode
224 /// Default accessibility implementation. Overriding View.Accessibility...()
225 /// virtual methods will have no effect.
227 [EditorBrowsable(EditorBrowsableState.Never)]
230 /// Custom accessibility implementation. Overriding View.Accessibility...()
231 /// will be necessary to provide accessibility support for the View.
233 [EditorBrowsable(EditorBrowsableState.Never)]
237 private static IntPtr NewWithAccessibilityMode(ViewAccessibilityMode accessibilityMode)
239 switch (accessibilityMode)
241 case ViewAccessibilityMode.Custom:
243 return Interop.View.NewCustom();
245 case ViewAccessibilityMode.Default:
248 return Interop.View.New();
254 /// Creates a new instance of a view.
256 /// <since_tizen> 3 </since_tizen>
257 public View() : this(ViewAccessibilityMode.Default)
261 [EditorBrowsable(EditorBrowsableState.Never)]
262 public View(ViewAccessibilityMode accessibilityMode) : this(NewWithAccessibilityMode(accessibilityMode), true)
264 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
268 [EditorBrowsable(EditorBrowsableState.Never)]
269 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
274 /// Create a new instance of a View with setting the status of shown or hidden.
276 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
277 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
278 [EditorBrowsable(EditorBrowsableState.Never)]
279 public View(bool shown) : this(Interop.View.New(), true)
281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
285 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
287 InitializeStyle(viewStyle);
290 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : this(cPtr, cMemoryOwn, shown, cMemoryOwn)
294 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
298 PositionUsesPivotPoint = false;
299 GrabTouchAfterLeave = defaultGrabTouchAfterLeave;
300 AllowOnlyOwnTouch = defaultAllowOnlyOwnTouch;
311 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
322 /// The event that is triggered when the View's ControlState is changed.
324 [EditorBrowsable(EditorBrowsableState.Never)]
325 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
327 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
331 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
333 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
334 [EditorBrowsable(EditorBrowsableState.Never)]
335 public bool LayoutSet
344 /// Flag to allow Layouting to be disabled for Views.
345 /// Once a View has a Layout set then any children added to Views from then on will receive
346 /// automatic Layouts.
348 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
349 [EditorBrowsable(EditorBrowsableState.Never)]
350 public static bool LayoutingDisabled { get; set; } = true;
353 /// If set to true, the <see cref="GrabTouchAfterLeave"/> property value is set to true when all Views are created.
355 /// <param name="enable">Sets value of GrabTouchAfterLeave property</param>
356 [EditorBrowsable(EditorBrowsableState.Never)]
357 public static void SetDefaultGrabTouchAfterLeave(bool enable)
359 defaultGrabTouchAfterLeave = enable;
363 /// If set to true, the <see cref="AllowOnlyOwnTouch"/> property value is set to true when all Views are created.
365 /// <param name="enable">Sets value of AllowOnlyOwnTouch property</param>
366 [EditorBrowsable(EditorBrowsableState.Never)]
367 public static void SetDefaultAllowOnlyOwnTouch(bool enable)
369 defaultAllowOnlyOwnTouch = enable;
373 /// Deprecate. Do not use this.
374 /// The style instance applied to this view.
375 /// Note that do not modify the ViewStyle.
376 /// Modifying ViewStyle will affect other views with same ViewStyle.
378 [EditorBrowsable(EditorBrowsableState.Never)]
379 protected ViewStyle ViewStyle
383 if (themeData == null) themeData = new ThemeData();
385 if (themeData.viewStyle == null)
387 ApplyStyle(CreateViewStyle());
389 return themeData.viewStyle;
394 /// Get/Set the control state.
395 /// Note that the ControlState only available for the classes derived from Control.
396 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
397 /// please set <see cref="EnableControlState"/> to true.
399 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
400 [EditorBrowsable(EditorBrowsableState.Never)]
401 public ControlState ControlState
405 return themeData == null ? ControlState.Normal : themeData.controlStates;
409 if (ControlState == value)
414 var prevState = ControlState;
416 if (themeData == null) themeData = new ThemeData();
417 themeData.controlStates = value;
419 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
421 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
423 if (themeData.ControlStatePropagation)
425 foreach (View child in Children)
427 ControlState allowed = child.PropagatableControlStates;
428 if (allowed.Contains(ControlState.All))
430 child.ControlState = value;
434 ControlState newControlState = child.ControlState;
436 if (allowed.Contains(ControlState.Normal))
438 if (value.Contains(ControlState.Normal))
440 newControlState += ControlState.Normal;
444 newControlState -= ControlState.Normal;
448 if (allowed.Contains(ControlState.Disabled))
450 if (value.Contains(ControlState.Disabled))
452 newControlState += ControlState.Disabled;
456 newControlState -= ControlState.Disabled;
460 if (allowed.Contains(ControlState.Selected))
462 if (value.Contains(ControlState.Selected))
464 newControlState += ControlState.Selected;
468 newControlState -= ControlState.Selected;
472 if (allowed.Contains(ControlState.Pressed))
474 if (value.Contains(ControlState.Pressed))
476 newControlState += ControlState.Pressed;
480 newControlState -= ControlState.Pressed;
484 if (allowed.Contains(ControlState.Focused))
486 if (value.Contains(ControlState.Focused))
488 newControlState += ControlState.Focused;
492 newControlState -= ControlState.Focused;
496 if (allowed.Contains(ControlState.Other))
498 if (value.Contains(ControlState.Other))
500 newControlState += ControlState.Other;
504 newControlState -= ControlState.Other;
508 if (child.ControlState != newControlState)
509 child.ControlState = newControlState;
514 OnControlStateChanged(changeInfo);
516 ControlStateChangedEvent?.Invoke(this, changeInfo);
521 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
523 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
524 [EditorBrowsable(EditorBrowsableState.Never)]
525 public bool ExcludeLayouting
529 return (bool)GetValue(ExcludeLayoutingProperty);
533 SetValue(ExcludeLayoutingProperty, value);
534 NotifyPropertyChanged();
538 private bool InternalExcludeLayouting
542 return excludeLayouting;
546 excludeLayouting = value;
547 if (Layout != null && Layout.SetPositionByLayout == value)
549 Layout.SetPositionByLayout = !value;
550 Layout.RequestLayout();
556 /// The StyleName, type string.
557 /// The value indicates DALi style name defined in json theme file.
559 /// <since_tizen> 3 </since_tizen>
560 public string StyleName
564 return (string)GetValue(StyleNameProperty);
568 SetValue(StyleNameProperty, value);
569 NotifyPropertyChanged();
574 /// The KeyInputFocus, type bool.
576 [EditorBrowsable(EditorBrowsableState.Never)]
577 public bool KeyInputFocus
581 return (bool)GetValue(KeyInputFocusProperty);
585 SetValue(KeyInputFocusProperty, value);
586 NotifyPropertyChanged();
591 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
595 /// The property cascade chaining set is not recommended.
598 /// Animatable - This property can be animated using <c>Animation</c> class.
600 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
605 /// This way is recommended for setting the property
607 /// var view = new View();
608 /// view.BackgroundColor = new Color(0.5f, 0.1f, 0, 1);
610 /// This way to set the property is prohibited
612 /// view.BackgroundColor.R = 0.5f; //This does not guarantee a proper operation
615 /// <since_tizen> 3 </since_tizen>
616 public Color BackgroundColor
620 if (NUIApplication.IsUsingXaml)
622 return (Color)GetValue(BackgroundColorProperty);
626 return (Color)GetInternalBackgroundColorProperty(this);
631 if (NUIApplication.IsUsingXaml)
633 SetValue(BackgroundColorProperty, value);
637 SetInternalBackgroundColorProperty(this, null, value);
639 NotifyPropertyChanged();
644 /// The mutually exclusive with "backgroundColor" and "background" type Map.
646 /// <since_tizen> 3 </since_tizen>
647 public string BackgroundImage
651 return (string)GetValue(BackgroundImageProperty);
655 SetValue(BackgroundImageProperty, value);
656 NotifyPropertyChanged();
661 /// Get or set the border of background image.
663 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
664 [EditorBrowsable(EditorBrowsableState.Never)]
665 public Rectangle BackgroundImageBorder
669 return (Rectangle)GetValue(BackgroundImageBorderProperty);
673 SetValue(BackgroundImageBorderProperty, value);
674 NotifyPropertyChanged();
679 /// The background of view.
681 /// <since_tizen> 3 </since_tizen>
682 public Tizen.NUI.PropertyMap Background
686 return (PropertyMap)GetValue(BackgroundProperty);
690 SetValue(BackgroundProperty, value);
691 NotifyPropertyChanged();
696 /// Describes a shadow as an image for a View.
697 /// It is null by default.
700 /// Getter returns copied instance of current shadow.
703 /// The mutually exclusive with "BoxShadow".
707 /// Animatable - This property can be animated using <c>Animation</c> class.
708 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
710 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
712 /// Animatable sub-property : Offset.
715 [EditorBrowsable(EditorBrowsableState.Never)]
716 public ImageShadow ImageShadow
720 return (ImageShadow)GetValue(ImageShadowProperty);
724 SetValue(ImageShadowProperty, value);
725 NotifyPropertyChanged();
730 /// Describes a box shaped shadow drawing for a View.
731 /// It is null by default.
734 /// The mutually exclusive with "ImageShadow".
738 /// Animatable - This property can be animated using <c>Animation</c> class.
739 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
741 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
743 /// Animatable sub-property : Offset, Color, BlurRadius.
746 /// <since_tizen> 9 </since_tizen>
747 public Shadow BoxShadow
751 return (Shadow)GetValue(BoxShadowProperty);
755 SetValue(BoxShadowProperty, value);
756 NotifyPropertyChanged();
761 /// The radius for the rounded corners of the View.
762 /// This will rounds background and shadow edges.
763 /// 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).
764 /// Each radius will clamp internally to the half of smaller of the view's width or height.
765 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
769 /// Animatable - This property can be animated using <c>Animation</c> class.
771 /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10));
775 /// <since_tizen> 9 </since_tizen>
776 public Vector4 CornerRadius
780 return (Vector4)GetValue(CornerRadiusProperty);
784 SetValue(CornerRadiusProperty, value);
785 NotifyPropertyChanged();
790 /// Whether the CornerRadius property value is relative (percentage [0.0f to 0.5f] of the view size) or absolute (in world units).
791 /// It is absolute by default.
792 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
794 /// <since_tizen> 9 </since_tizen>
795 public VisualTransformPolicyType CornerRadiusPolicy
797 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
798 set => SetValue(CornerRadiusPolicyProperty, value);
802 /// The width for the borderline of the View.
806 /// Animatable - This property can be animated using <c>Animation</c> class.
808 /// animation.AnimateTo(view, "BorderlineWidth", 100.0f);
811 /// Note that, an image background may not have borderline if it uses the Border property.
813 /// <since_tizen> 9 </since_tizen>
814 public float BorderlineWidth
818 return (float)GetValue(BorderlineWidthProperty);
822 SetValue(BorderlineWidthProperty, value);
823 NotifyPropertyChanged();
828 /// The color for the borderline of the View.
829 /// It is Color.Black by default.
833 /// Animatable - This property can be animated using <c>Animation</c> class.
835 /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a));
839 /// <since_tizen> 9 </since_tizen>
840 public Color BorderlineColor
844 return (Color)GetValue(BorderlineColorProperty);
848 SetValue(BorderlineColorProperty, value);
849 NotifyPropertyChanged();
854 /// The color selector for the borderline of the View.
855 /// Like BackgroundColor, color selector typed BorderlineColor should be used in ViewStyle only.
856 /// So this API is internally used only.
858 internal Selector<Color> BorderlineColorSelector
862 return (Selector<Color>)GetValue(BorderlineColorSelectorProperty);
866 SetValue(BorderlineColorSelectorProperty, value);
867 NotifyPropertyChanged();
872 /// The Relative offset for the borderline of the View.
873 /// Recommended range : [-1.0f to 1.0f].
874 /// If -1.0f, draw borderline inside of the View.
875 /// If 1.0f, draw borderline outside of the View.
876 /// If 0.0f, draw borderline half inside and half outside.
877 /// It is 0.0f by default.
881 /// Animatable - This property can be animated using <c>Animation</c> class.
883 /// animation.AnimateTo(view, "BorderlineOffset", -1.0f);
887 /// <since_tizen> 9 </since_tizen>
888 public float BorderlineOffset
892 return (float)GetValue(BorderlineOffsetProperty);
896 SetValue(BorderlineOffsetProperty, value);
897 NotifyPropertyChanged();
902 /// The current state of the view.
904 /// <since_tizen> 3 </since_tizen>
909 return (States)GetValue(StateProperty);
913 SetValue(StateProperty, value);
914 NotifyPropertyChanged();
919 /// The current sub state of the view.
921 /// <since_tizen> 3 </since_tizen>
922 public States SubState
926 return (States)GetValue(SubStateProperty);
930 SetValue(SubStateProperty, value);
931 NotifyPropertyChanged();
936 /// Displays a tooltip
938 /// <since_tizen> 3 </since_tizen>
939 public Tizen.NUI.PropertyMap Tooltip
943 return (PropertyMap)GetValue(TooltipProperty);
947 SetValue(TooltipProperty, value);
948 NotifyPropertyChanged();
953 /// Displays a tooltip as a text.
955 /// <since_tizen> 3 </since_tizen>
956 public string TooltipText
960 return GetValue(TooltipTextProperty) as string;
964 SetValue(TooltipTextProperty, value);
968 private string InternalTooltipText
972 using (var propertyValue = GetProperty(Property.TOOLTIP))
974 using var propertyMap = new PropertyMap();
975 if (propertyValue != null && propertyValue.Get(propertyMap))
977 using var retrivedContentValue = propertyMap?.Find(NDalic.TooltipContent);
978 if (retrivedContentValue != null)
980 using var contextPropertyMap = new PropertyMap();
981 if (retrivedContentValue.Get(contextPropertyMap))
983 using var retrivedTextValue = contextPropertyMap?.Find(NDalic.TextVisualText);
984 if (retrivedTextValue != null && retrivedTextValue.Get(out string retrivedValue))
986 return retrivedValue;
996 var temp = new Tizen.NUI.PropertyValue(value);
997 SetProperty(View.Property.TOOLTIP, temp);
999 NotifyPropertyChanged();
1004 /// The Child property of FlexContainer.<br />
1005 /// The proportion of the free space in the container, the flex item will receive.<br />
1006 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
1008 /// <since_tizen> 3 </since_tizen>
1009 [Obsolete("Deprecated in API8, will be removed in API10.")]
1014 return (float)GetValue(FlexProperty);
1018 SetValue(FlexProperty, value);
1019 NotifyPropertyChanged();
1024 /// The Child property of FlexContainer.<br />
1025 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
1027 /// <since_tizen> 3 </since_tizen>
1028 [Obsolete("Deprecated in API8, will be removed in API10.")]
1029 public int AlignSelf
1033 return (int)GetValue(AlignSelfProperty);
1037 SetValue(AlignSelfProperty, value);
1038 NotifyPropertyChanged();
1043 /// The Child property of FlexContainer.<br />
1044 /// The space around the flex item.<br />
1047 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
1049 /// <since_tizen> 3 </since_tizen>
1050 [Obsolete("Deprecated in API8, will be removed in API10.")]
1051 public Vector4 FlexMargin
1055 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
1056 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
1060 SetValue(FlexMarginProperty, value);
1061 NotifyPropertyChanged();
1066 /// The top-left cell this child occupies, if not set, the first available cell is used.
1069 /// The property cascade chaining set is not recommended.
1070 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
1073 /// This way is recommended for setting the property
1075 /// var view = new View();
1076 /// view.CellIndex = new Vector2(1, 3);
1078 /// This way to set the property is prohibited
1080 /// view.CellIndex.X = 1; //This does not guarantee a proper operation
1083 /// <since_tizen> 3 </since_tizen>
1084 public Vector2 CellIndex
1088 if (NUIApplication.IsUsingXaml)
1090 return (Vector2)GetValue(CellIndexProperty);
1094 return (Vector2)GetInternalCellIndexProperty(this);
1101 if (NUIApplication.IsUsingXaml)
1103 SetValue(CellIndexProperty, value);
1107 SetInternalCellIndexProperty(this, null, value);
1111 NotifyPropertyChanged();
1116 /// The number of rows this child occupies, if not set, the default value is 1.
1119 /// This property is for <see cref="TableView"/> class. Use the property for the child position of <see cref="TableView"/>.
1121 /// <since_tizen> 3 </since_tizen>
1122 public float RowSpan
1126 return (float)GetValue(RowSpanProperty);
1130 SetValue(RowSpanProperty, value);
1131 NotifyPropertyChanged();
1136 /// The number of columns this child occupies, if not set, the default value is 1.
1139 /// This property is for <see cref="TableView"/> class. Use the property for the child position of <see cref="TableView"/>.
1141 /// <since_tizen> 3 </since_tizen>
1142 public float ColumnSpan
1146 return (float)GetValue(ColumnSpanProperty);
1150 SetValue(ColumnSpanProperty, value);
1151 NotifyPropertyChanged();
1156 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
1159 /// This property is for <see cref="TableView"/> class. Use the property for the child position of <see cref="TableView"/>.
1161 /// <since_tizen> 3 </since_tizen>
1162 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
1166 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
1170 SetValue(CellHorizontalAlignmentProperty, value);
1171 NotifyPropertyChanged();
1176 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
1179 /// This property is for <see cref="TableView"/> class. Use the property for the child position of <see cref="TableView"/>.
1181 /// <since_tizen> 3 </since_tizen>
1182 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
1186 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
1190 SetValue(CellVerticalAlignmentProperty, value);
1191 NotifyPropertyChanged();
1196 /// The left focusable view.<br />
1197 /// This will return null if not set.<br />
1198 /// This will also return null if the specified left focusable view is not on a window.<br />
1200 /// <since_tizen> 3 </since_tizen>
1201 public View LeftFocusableView
1203 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1206 return (View)GetValue(LeftFocusableViewProperty);
1210 SetValue(LeftFocusableViewProperty, value);
1211 NotifyPropertyChanged();
1216 /// The right focusable view.<br />
1217 /// This will return null if not set.<br />
1218 /// This will also return null if the specified right focusable view is not on a window.<br />
1220 /// <since_tizen> 3 </since_tizen>
1221 public View RightFocusableView
1223 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1226 return (View)GetValue(RightFocusableViewProperty);
1230 SetValue(RightFocusableViewProperty, value);
1231 NotifyPropertyChanged();
1236 /// The up focusable view.<br />
1237 /// This will return null if not set.<br />
1238 /// This will also return null if the specified up focusable view is not on a window.<br />
1240 /// <since_tizen> 3 </since_tizen>
1241 public View UpFocusableView
1243 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1246 return (View)GetValue(UpFocusableViewProperty);
1250 SetValue(UpFocusableViewProperty, value);
1251 NotifyPropertyChanged();
1256 /// The down focusable view.<br />
1257 /// This will return null if not set.<br />
1258 /// This will also return null if the specified down focusable view is not on a window.<br />
1260 /// <since_tizen> 3 </since_tizen>
1261 public View DownFocusableView
1263 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1266 return (View)GetValue(DownFocusableViewProperty);
1270 SetValue(DownFocusableViewProperty, value);
1271 NotifyPropertyChanged();
1276 /// The clockwise focusable view by rotary wheel.<br />
1277 /// This will return null if not set.<br />
1278 /// This will also return null if the specified clockwise focusable view is not on a window.<br />
1280 [EditorBrowsable(EditorBrowsableState.Never)]
1281 public View ClockwiseFocusableView
1283 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1286 return (View)GetValue(ClockwiseFocusableViewProperty);
1290 SetValue(ClockwiseFocusableViewProperty, value);
1291 NotifyPropertyChanged();
1296 /// The counter clockwise focusable view by rotary wheel.<br />
1297 /// This will return null if not set.<br />
1298 /// This will also return null if the specified counter clockwise focusable view is not on a window.<br />
1300 [EditorBrowsable(EditorBrowsableState.Never)]
1301 public View CounterClockwiseFocusableView
1303 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1306 return (View)GetValue(CounterClockwiseFocusableViewProperty);
1310 SetValue(CounterClockwiseFocusableViewProperty, value);
1311 NotifyPropertyChanged();
1316 /// Whether the view should be focusable by keyboard navigation.
1318 /// <since_tizen> 3 </since_tizen>
1319 public bool Focusable
1323 SetValue(FocusableProperty, value);
1324 NotifyPropertyChanged();
1328 return (bool)GetValue(FocusableProperty);
1333 /// Whether the children of this view can be focusable by keyboard navigation. If user sets this to false, the children of this actor view will not be focused.
1334 /// Note : Default value is true.
1336 [EditorBrowsable(EditorBrowsableState.Never)]
1337 public bool FocusableChildren
1341 SetValue(FocusableChildrenProperty, value);
1342 NotifyPropertyChanged();
1346 return (bool)GetValue(FocusableChildrenProperty);
1351 /// Whether this view can focus by touch.
1352 /// If Focusable is false, FocusableInTouch is disabled.
1353 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
1355 [EditorBrowsable(EditorBrowsableState.Never)]
1356 public bool FocusableInTouch
1360 SetValue(FocusableInTouchProperty, value);
1361 NotifyPropertyChanged();
1365 return (bool)GetValue(FocusableInTouchProperty);
1370 /// Retrieves the position of the view.
1371 /// The coordinates are relative to the view's parent.
1374 /// The <see cref="Size"/>, <see cref="Position"/>, <see cref="Color"/>, and <see cref="Scale"/> properties are set in the main thread.
1375 /// Therefore, it is not updated in real time when the value is changed in the render thread (for example, the value is changed during animation).
1376 /// However, <see cref="CurrentSize"/>, <see cref="CurrentPosition"/>, <see cref="CurrentColor"/>, and <see cref="CurrentScale"/> properties are updated in real time,
1377 /// and users can get the current actual values through them.
1379 /// <since_tizen> 3 </since_tizen>
1380 public Position CurrentPosition
1384 return GetCurrentPosition();
1389 /// Sets the size of a view for the width and the height.<br />
1390 /// Geometry can be scaled to fit within this area.<br />
1391 /// This does not interfere with the view's scale factor.<br />
1392 /// The views default depth is the minimum of width and height.<br />
1395 /// The property cascade chaining set is not recommended.
1398 /// This way is recommended for setting the property
1400 /// var view = new View();
1401 /// view.Size2D = new Size2D(100, 200);
1403 /// This way to set the property is prohibited
1405 /// view.Size2D.Width = 100; //This does not guarantee a proper operation
1408 /// <since_tizen> 3 </since_tizen>
1409 public Size2D Size2D
1413 if (NUIApplication.IsUsingXaml)
1415 var temp = (Size2D)GetValue(Size2DProperty);
1416 if (this.Layout == null)
1418 if (temp.Width < 0) { temp.Width = 0; }
1419 if (temp.Height < 0) { temp.Height = 0; }
1425 var temp = (Size2D)GetInternalSize2DProperty(this);
1426 if (this.Layout == null)
1428 if (temp.Width < 0) { temp.Width = 0; }
1429 if (temp.Height < 0) { temp.Height = 0; }
1436 if (NUIApplication.IsUsingXaml)
1438 SetValue(Size2DProperty, value);
1442 SetInternalSize2DProperty(this, null, value);
1444 NotifyPropertyChanged();
1449 /// Retrieves the size of the view.
1450 /// The coordinates are relative to the view's parent.
1453 /// The <see cref="Size"/>, <see cref="Position"/>, <see cref="Color"/>, and <see cref="Scale"/> properties are set in the main thread.
1454 /// Therefore, it is not updated in real time when the value is changed in the render thread (for example, the value is changed during animation).
1455 /// However, <see cref="CurrentSize"/>, <see cref="CurrentPosition"/>, <see cref="CurrentColor"/>, and <see cref="CurrentScale"/> properties are updated in real time,
1456 /// and users can get the current actual values through them.
1458 /// <since_tizen> 3 </since_tizen>
1459 public Size2D CurrentSize
1463 return GetCurrentSize();
1468 /// Retrieves and sets the view's opacity.<br />
1472 /// Animatable - This property can be animated using <c>Animation</c> class.
1474 /// animation.AnimateTo(view, "Opacity", 0.5f);
1478 /// <since_tizen> 3 </since_tizen>
1479 public float Opacity
1483 return (float)GetValue(OpacityProperty);
1487 SetValue(OpacityProperty, value);
1488 NotifyPropertyChanged();
1493 /// Sets the position of the view for X and Y.<br />
1494 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1495 /// If the position inheritance is disabled, sets the world position.<br />
1498 /// The property cascade chaining set is not recommended.
1501 /// This way is recommended for setting the property
1503 /// var view = new View();
1504 /// view.Position2D = new Position2D(100, 200);
1506 /// This way to set the property is prohibited
1508 /// view.Position2D.X = 100; //This does not guarantee a proper operation
1511 /// <since_tizen> 3 </since_tizen>
1512 public Position2D Position2D
1516 if (NUIApplication.IsUsingXaml)
1518 return (Position2D)GetValue(Position2DProperty);
1522 return (Position2D)GetInternalPosition2DProperty(this);
1528 if (NUIApplication.IsUsingXaml)
1530 SetValue(Position2DProperty, value);
1534 SetInternalPosition2DProperty(this, null, value);
1537 NotifyPropertyChanged();
1542 /// Retrieves the screen position of the view.<br />
1544 /// <since_tizen> 3 </since_tizen>
1545 public Vector2 ScreenPosition
1549 return GetCurrentScreenPosition();
1554 /// Retrieves the screen position and size of the view.<br />
1557 /// The float type Rectangle class is not ready yet.
1558 /// Therefore, it transmits data in Vector4 class.
1559 /// This type should later be changed to the appropriate data type.
1561 [EditorBrowsable(EditorBrowsableState.Never)]
1562 public Vector4 ScreenPositionSize
1566 return GetCurrentScreenPositionSize();
1571 /// Determines whether the pivot point should be used to determine the position of the view.
1572 /// This is false by default.
1574 /// <remarks>If false, then the top-left of the view is used for the position.
1575 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1577 /// <since_tizen> 3 </since_tizen>
1578 public bool PositionUsesPivotPoint
1582 return (bool)GetValue(PositionUsesPivotPointProperty);
1586 SetValue(PositionUsesPivotPointProperty, value);
1587 NotifyPropertyChanged();
1592 /// This has been deprecated in API5 and Will be removed in API8. Use PositionUsesPivotPoint instead.
1594 /// <since_tizen> 3 </since_tizen>
1595 [Obsolete("This has been deprecated in API5 and will be removed in API8. Use PositionUsesPivotPoint instead. " +
1597 "View view = new View(); " +
1598 "view.PivotPoint = PivotPoint.Center; " +
1599 "view.PositionUsesPivotPoint = true;" +
1600 " This has been deprecated in API5 and will be removed in API8")]
1601 [EditorBrowsable(EditorBrowsableState.Never)]
1602 public bool PositionUsesAnchorPoint
1606 return (bool)GetValue(PositionUsesAnchorPointProperty);
1610 SetValue(PositionUsesAnchorPointProperty, value);
1614 private bool InternalPositionUsesAnchorPoint
1618 return Object.InternalGetPropertyBool(SwigCPtr, View.Property.PositionUsesAnchorPoint);
1622 Object.InternalSetPropertyBool(SwigCPtr, View.Property.PositionUsesAnchorPoint, value);
1623 NotifyPropertyChanged();
1628 /// Queries whether the view is connected to the stage.<br />
1629 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1631 /// <since_tizen> 3 </since_tizen>
1632 public bool IsOnWindow
1641 /// Gets the depth in the hierarchy for the view.
1643 /// <since_tizen> 3 </since_tizen>
1644 public int HierarchyDepth
1648 return GetHierarchyDepth();
1653 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1656 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1657 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1658 /// The values set by this property will likely change.
1660 /// <since_tizen> 3 </since_tizen>
1661 public int SiblingOrder
1665 return (int)GetValue(SiblingOrderProperty);
1669 SetValue(SiblingOrderProperty, value);
1671 Layout?.ChangeLayoutSiblingOrder(value);
1673 NotifyPropertyChanged();
1678 /// Returns the natural size of the view.
1681 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1683 /// <since_tizen> 5 </since_tizen>
1684 public Vector3 NaturalSize
1688 Vector3 ret = GetNaturalSize();
1689 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1695 /// Returns the natural size (Size2D) of the view.
1698 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1700 /// <since_tizen> 4 </since_tizen>
1701 public Size2D NaturalSize2D
1705 Vector3 temp = GetNaturalSize();
1706 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1710 sz = new Size2D((int)temp.Width, (int)temp.Height);
1718 /// Gets or sets the origin of a view within its parent's area.<br />
1719 /// 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 />
1720 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1721 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1723 /// <pre>The view has been initialized.</pre>
1724 /// <since_tizen> 3 </since_tizen>
1725 public Position ParentOrigin
1729 if (NUIApplication.IsUsingXaml)
1731 var tmp = (Position)GetValue(ParentOriginProperty);
1732 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1736 var tmp = (Position)GetInternalParentOriginProperty(this);
1737 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1742 if (NUIApplication.IsUsingXaml)
1744 SetValue(ParentOriginProperty, value);
1748 SetInternalParentOriginProperty(this, null, value);
1750 NotifyPropertyChanged();
1755 /// Gets or sets the anchor-point of a view.<br />
1756 /// 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 />
1757 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1758 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1759 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1760 /// <pre>The view has been initialized.</pre>
1763 /// The property cascade chaining set is not recommended.
1766 /// This way is recommended for setting the property
1768 /// var view = new View();
1769 /// view.PivotPoint = PivotPoint.Center;
1771 /// This way to set the property is prohibited
1773 /// view.PivotPoint.X = 0.5f; //This does not guarantee a proper operation
1776 /// <since_tizen> 3 </since_tizen>
1777 public Position PivotPoint
1781 if (NUIApplication.IsUsingXaml)
1783 return (Position)GetValue(PivotPointProperty);
1787 return (Position)GetInternalPivotPointProperty(this);
1794 if (NUIApplication.IsUsingXaml)
1796 SetValue(PivotPointProperty, value);
1800 SetInternalPivotPointProperty(this, null, value);
1803 NotifyPropertyChanged();
1808 /// Gets or sets the size width of the view.
1812 /// Animatable - This property can be animated using <c>Animation</c> class.
1814 /// animation.AnimateTo(view, "SizeWidth", 500.0f);
1818 /// <since_tizen> 3 </since_tizen>
1819 public float SizeWidth
1823 if (NUIApplication.IsUsingXaml)
1825 return (float)GetValue(SizeWidthProperty);
1829 return (float)GetInternalSizeWidthProperty(this);
1836 if (NUIApplication.IsUsingXaml)
1838 SetValue(SizeWidthProperty, value);
1842 SetInternalSizeWidthProperty(this, null, value);
1845 NotifyPropertyChanged();
1850 /// Gets or sets the size height of the view.
1854 /// Animatable - This property can be animated using <c>Animation</c> class.
1857 /// animation.AnimateTo(view, "SizeHeight", 500.0f);
1860 /// <since_tizen> 3 </since_tizen>
1861 public float SizeHeight
1865 if (NUIApplication.IsUsingXaml)
1867 return (float)GetValue(SizeHeightProperty);
1871 return (float)GetInternalSizeHeightProperty(this);
1878 if (NUIApplication.IsUsingXaml)
1880 SetValue(SizeHeightProperty, value);
1884 SetInternalSizeHeightProperty(this, null, value);
1888 NotifyPropertyChanged();
1893 /// Gets or sets the position of the view.<br />
1894 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1895 /// If the position inheritance is disabled, sets the world position.<br />
1899 /// Animatable - This property can be animated using <c>Animation</c> class.
1901 /// animation.AnimateTo(view, "Position", new Position(50, 0));
1904 /// The property cascade chaining set is not recommended.
1907 /// This way is recommended for setting the property
1909 /// var view = new View();
1910 /// view.Position = new Position(100, 200.5f, 0);
1912 /// This way to set the property is prohibited
1914 /// view.Position.Y = 200.5f; //This does not guarantee a proper operation
1917 /// <since_tizen> 3 </since_tizen>
1918 public Position Position
1922 if (NUIApplication.IsUsingXaml)
1924 return (Position)GetValue(PositionProperty);
1928 return (Position2D)GetInternalPositionProperty(this);
1933 if (NUIApplication.IsUsingXaml)
1935 SetValue(PositionProperty, value);
1939 SetInternalPositionProperty(this, null, value);
1941 NotifyPropertyChanged();
1946 /// Gets or sets the position X of the view.
1950 /// Animatable - This property can be animated using <c>Animation</c> class.
1952 /// animation.AnimateTo(view, "PositionX", 50.0f);
1956 /// <since_tizen> 3 </since_tizen>
1957 public float PositionX
1961 if (NUIApplication.IsUsingXaml)
1963 return (float)GetValue(PositionXProperty);
1967 return (float)GetInternalPositionXProperty(this);
1972 if (NUIApplication.IsUsingXaml)
1974 SetValue(PositionXProperty, value);
1978 SetInternalPositionXProperty(this, null, value);
1980 NotifyPropertyChanged();
1985 /// Gets or sets the position Y of the view.
1989 /// Animatable - This property can be animated using <c>Animation</c> class.
1991 /// animation.AnimateTo(view, "PositionY", 50.0f);
1995 /// <since_tizen> 3 </since_tizen>
1996 public float PositionY
2000 if (NUIApplication.IsUsingXaml)
2002 return (float)GetValue(PositionYProperty);
2006 return (float)GetInternalPositionYProperty(this);
2011 if (NUIApplication.IsUsingXaml)
2013 SetValue(PositionYProperty, value);
2017 SetInternalPositionYProperty(this, null, value);
2019 NotifyPropertyChanged();
2024 /// Gets or sets the position Z of the view.
2028 /// Animatable - This property can be animated using <c>Animation</c> class.
2030 /// animation.AnimateTo(view, "PositionZ", 50.0f);
2034 /// <since_tizen> 3 </since_tizen>
2035 public float PositionZ
2039 if (NUIApplication.IsUsingXaml)
2041 return (float)GetValue(PositionZProperty);
2045 return (float)GetInternalPositionZProperty(this);
2052 if (NUIApplication.IsUsingXaml)
2054 SetValue(PositionZProperty, value);
2058 SetInternalPositionZProperty(this, null, value);
2061 NotifyPropertyChanged();
2066 /// Gets or sets the world position of the view.
2068 /// <since_tizen> 3 </since_tizen>
2069 public Vector3 WorldPosition
2073 return GetCurrentWorldPosition();
2078 /// Gets or sets the orientation of the view.<br />
2079 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
2083 /// This is an asynchronous method.
2086 /// Animatable - This property can be animated using <c>Animation</c> class.
2088 /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis));
2092 /// <since_tizen> 3 </since_tizen>
2093 public Rotation Orientation
2097 return (Rotation)GetValue(OrientationProperty);
2101 SetValue(OrientationProperty, value);
2102 NotifyPropertyChanged();
2107 /// Gets or sets the world orientation of the view.<br />
2109 /// <since_tizen> 3 </since_tizen>
2110 public Rotation WorldOrientation
2114 Rotation temp = new Rotation();
2115 var pValue = GetProperty(View.Property.WorldOrientation);
2123 /// Gets or sets the scale factor applied to the view.<br />
2127 /// Animatable - This property can be animated using <c>Animation</c> class.
2129 /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f));
2132 /// The property cascade chaining set is not recommended.
2135 /// This way is recommended for setting the property
2137 /// var view = new View();
2138 /// view.Scale = new Vector3(1.5f, 2.0f, 1.0f);
2140 /// This way to set the property is prohibited
2142 /// view.Scale.Width = 1.5f; //This does not guarantee a proper operation
2145 /// <since_tizen> 3 </since_tizen>
2146 public Vector3 Scale
2150 if (NUIApplication.IsUsingXaml)
2152 return (Vector3)GetValue(ScaleProperty);
2156 return (Vector3)GetInternalScaleProperty(this);
2163 if (NUIApplication.IsUsingXaml)
2165 SetValue(ScaleProperty, value);
2169 SetInternalScaleProperty(this, null, value);
2173 NotifyPropertyChanged();
2178 /// Gets or sets the scale X factor applied to the view.
2182 /// Animatable - This property can be animated using <c>Animation</c> class.
2184 /// animation.AnimateTo(view, "ScaleX", 1.5f);
2188 /// <since_tizen> 3 </since_tizen>
2193 if (NUIApplication.IsUsingXaml)
2195 return (float)GetValue(ScaleXProperty);
2199 return (float)GetInternalScaleXProperty(this);
2206 if (NUIApplication.IsUsingXaml)
2208 SetValue(ScaleXProperty, value);
2212 SetInternalScaleXProperty(this, null, value);
2216 NotifyPropertyChanged();
2221 /// Gets or sets the scale Y factor applied to the view.
2225 /// Animatable - This property can be animated using <c>Animation</c> class.
2227 /// animation.AnimateTo(view, "ScaleY", 1.5f);
2231 /// <since_tizen> 3 </since_tizen>
2236 if (NUIApplication.IsUsingXaml)
2238 return (float)GetValue(ScaleYProperty);
2242 return (float)GetInternalScaleYProperty(this);
2249 if (NUIApplication.IsUsingXaml)
2251 SetValue(ScaleYProperty, value);
2255 SetInternalScaleYProperty(this, null, value);
2259 NotifyPropertyChanged();
2264 /// Gets or sets the scale Z factor applied to the view.
2268 /// Animatable - This property can be animated using <c>Animation</c> class.
2270 /// animation.AnimateTo(view, "ScaleZ", 1.5f);
2274 /// <since_tizen> 3 </since_tizen>
2279 if (NUIApplication.IsUsingXaml)
2281 return (float)GetValue(ScaleZProperty);
2285 return (float)GetInternalScaleZProperty(this);
2292 if (NUIApplication.IsUsingXaml)
2294 SetValue(ScaleZProperty, value);
2298 SetInternalScaleZProperty(this, null, value);
2302 NotifyPropertyChanged();
2307 /// Gets the world scale of the view.
2309 /// <since_tizen> 3 </since_tizen>
2310 public Vector3 WorldScale
2314 return GetCurrentWorldScale();
2319 /// Retrieves the visibility flag of the view.
2323 /// If the view is not visible, then the view and its children will not be rendered.
2324 /// 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.
2327 /// Animatable - This property can be animated using <c>Animation</c> class.
2329 /// animation.AnimateTo(view, "Visibility", false);
2333 /// <since_tizen> 3 </since_tizen>
2334 public bool Visibility
2338 return Object.InternalGetPropertyBool(SwigCPtr, View.Property.VISIBLE);
2343 /// Gets the view's world color.
2345 /// <since_tizen> 3 </since_tizen>
2346 public Vector4 WorldColor
2350 return GetCurrentWorldColor();
2355 /// Gets or sets the view's name.
2357 /// <since_tizen> 3 </since_tizen>
2362 if (NUIApplication.IsUsingXaml)
2364 return (string)GetValue(NameProperty);
2368 return (string)GetInternalNameProperty(this);
2375 if (NUIApplication.IsUsingXaml)
2377 SetValue(NameProperty, value);
2381 SetInternalNameProperty(this, null, value);
2385 NotifyPropertyChanged();
2390 /// Get the number of children held by the view.
2392 /// <since_tizen> 3 </since_tizen>
2393 public new uint ChildCount
2397 return Convert.ToUInt32(Children.Count);
2402 /// Gets the view's ID.
2405 /// <since_tizen> 3 </since_tizen>
2415 /// Gets or sets the status of whether the view should emit touch or hover signals.
2416 /// If a View is made insensitive, then the View and its children are not hittable.
2418 /// <since_tizen> 3 </since_tizen>
2419 public bool Sensitive
2423 return (bool)GetValue(SensitiveProperty);
2427 SetValue(SensitiveProperty, value);
2428 NotifyPropertyChanged();
2433 /// Gets or sets the status of whether the view should be enabled user interactions.
2434 /// If a View is made disabled, then user interactions including touch, focus, and actiavation is disabled.
2436 /// <since_tizen> tizen_next </since_tizen>
2437 [EditorBrowsable(EditorBrowsableState.Never)]
2438 public bool IsEnabled
2442 return (bool)GetValue(IsEnabledProperty);
2446 SetValue(IsEnabledProperty, value);
2447 NotifyPropertyChanged();
2452 /// 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.
2454 /// <since_tizen> 3 </since_tizen>
2455 public bool LeaveRequired
2459 return (bool)GetValue(LeaveRequiredProperty);
2463 SetValue(LeaveRequiredProperty, value);
2464 NotifyPropertyChanged();
2469 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
2471 /// <since_tizen> 3 </since_tizen>
2472 public bool InheritOrientation
2476 return (bool)GetValue(InheritOrientationProperty);
2480 SetValue(InheritOrientationProperty, value);
2481 NotifyPropertyChanged();
2486 /// Gets or sets the status of whether a child view inherits it's parent's scale.
2488 /// <since_tizen> 3 </since_tizen>
2489 public bool InheritScale
2493 return (bool)GetValue(InheritScaleProperty);
2497 SetValue(InheritScaleProperty, value);
2498 NotifyPropertyChanged();
2503 /// Gets or sets the status of how the view and its children should be drawn.<br />
2504 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
2505 /// 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 />
2506 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
2507 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
2508 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
2510 /// <since_tizen> 3 </since_tizen>
2511 public DrawModeType DrawMode
2515 return (DrawModeType)GetValue(DrawModeProperty);
2519 SetValue(DrawModeProperty, value);
2520 NotifyPropertyChanged();
2525 /// Gets or sets the relative to parent size factor of the view.<br />
2526 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
2527 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
2530 /// The property cascade chaining set is not recommended.
2533 /// This way is recommended for setting the property
2535 /// var text = new TextField();
2536 /// text.SizeModeFactor = new Vector3(1.0f, 0.45f, 1.0f);
2538 /// This way to set the property is prohibited
2540 /// text.SizeModeFactor.Width = 1.0f; //This does not guarantee a proper operation
2543 /// <since_tizen> 3 </since_tizen>
2544 public Vector3 SizeModeFactor
2548 if (NUIApplication.IsUsingXaml)
2550 return (Vector3)GetValue(SizeModeFactorProperty);
2554 return (Vector3)GetInternalSizeModeFactorProperty(this);
2561 if (NUIApplication.IsUsingXaml)
2563 SetValue(SizeModeFactorProperty, value);
2567 SetInternalSizeModeFactorProperty(this, null, value);
2571 NotifyPropertyChanged();
2576 /// Gets or sets the width resize policy to be used.
2578 /// <since_tizen> 3 </since_tizen>
2579 public ResizePolicyType WidthResizePolicy
2583 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
2587 SetValue(WidthResizePolicyProperty, value);
2588 NotifyPropertyChanged();
2593 /// Gets or sets the height resize policy to be used.
2595 /// <since_tizen> 3 </since_tizen>
2596 public ResizePolicyType HeightResizePolicy
2600 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
2604 SetValue(HeightResizePolicyProperty, value);
2605 NotifyPropertyChanged();
2610 /// Gets or sets the policy to use when setting size with size negotiation.<br />
2611 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
2613 /// <since_tizen> 3 </since_tizen>
2614 public SizeScalePolicyType SizeScalePolicy
2618 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
2622 SetValue(SizeScalePolicyProperty, value);
2623 NotifyPropertyChanged();
2628 /// Gets or sets the status of whether the width size is dependent on the height size.
2630 /// <since_tizen> 3 </since_tizen>
2631 public bool WidthForHeight
2635 return (bool)GetValue(WidthForHeightProperty);
2639 SetValue(WidthForHeightProperty, value);
2640 NotifyPropertyChanged();
2645 /// Gets or sets the status of whether the height size is dependent on the width size.
2647 /// <since_tizen> 3 </since_tizen>
2648 public bool HeightForWidth
2652 return (bool)GetValue(HeightForWidthProperty);
2656 SetValue(HeightForWidthProperty, value);
2657 NotifyPropertyChanged();
2662 /// Gets or sets the padding for use in layout.
2665 /// The property cascade chaining set is not recommended.
2668 /// This way is recommended for setting the property
2670 /// var view = new View();
2671 /// view.Padding = new Extents(5, 5, 5, 5);
2673 /// This way to set the property is prohibited
2675 /// view.Padding.Start = 5; //This does not guarantee a proper operation
2678 /// <since_tizen> 5 </since_tizen>
2679 public Extents Padding
2683 if (NUIApplication.IsUsingXaml)
2685 return (Extents)GetValue(PaddingProperty);
2689 return (Extents)GetInternalPaddingProperty(this);
2696 if (NUIApplication.IsUsingXaml)
2698 SetValue(PaddingProperty, value);
2702 SetInternalPaddingProperty(this, null, value);
2706 NotifyPropertyChanged();
2711 /// Gets or sets the minimum size the view can be assigned in size negotiation.
2713 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2715 /// The property cascade chaining set is not recommended.
2718 /// This way is recommended for setting the property
2720 /// var view = new View();
2721 /// view.MinimumSize = new Size2D(100, 200);
2723 /// This way to set the property is prohibited
2725 /// view.MinimumSize.Width = 100; //This does not guarantee a proper operation
2728 /// <since_tizen> 3 </since_tizen>
2729 public Size2D MinimumSize
2733 if (NUIApplication.IsUsingXaml)
2735 return (Size2D)GetValue(MinimumSizeProperty);
2739 return (Size2D)GetInternalMinimumSizeProperty(this);
2747 throw new ArgumentNullException(nameof(value));
2751 // Note: it only works if minimum size is >= than natural size.
2752 // To force the size it should be done through the width&height spec or Size2D.
2753 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
2754 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
2755 layout.RequestLayout();
2757 if (NUIApplication.IsUsingXaml)
2759 SetValue(MinimumSizeProperty, value);
2763 SetInternalMinimumSizeProperty(this, null, value);
2766 NotifyPropertyChanged();
2771 /// Gets or sets the maximum size the view can be assigned in size negotiation.
2774 /// This way is recommended for setting the property
2776 /// var view = new View();
2777 /// view.MaximumSize = new Size2D(100, 200);
2779 /// This way to set the property is prohibited
2781 /// view.MaximumSize.Height = 200; //This does not guarantee a proper operation
2784 /// <since_tizen> 3 </since_tizen>
2785 public Size2D MaximumSize
2789 if (NUIApplication.IsUsingXaml)
2791 return (Size2D)GetValue(MaximumSizeProperty);
2795 return (Size2D)GetInternalMaximumSizeProperty(this);
2800 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
2801 // MATCH_PARENT spec + parent container size can be used to limit
2804 layout.RequestLayout();
2807 if (NUIApplication.IsUsingXaml)
2809 SetValue(MaximumSizeProperty, value);
2813 SetInternalMaximumSizeProperty(this, null, value);
2816 NotifyPropertyChanged();
2821 /// Gets or sets whether a child view inherits it's parent's position.<br />
2822 /// Default is to inherit.<br />
2823 /// 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 />
2825 /// <since_tizen> 3 </since_tizen>
2826 public bool InheritPosition
2830 return (bool)GetValue(InheritPositionProperty);
2834 SetValue(InheritPositionProperty, value);
2835 NotifyPropertyChanged();
2840 /// Gets or sets the clipping behavior (mode) of it's children.
2842 /// <since_tizen> 3 </since_tizen>
2843 public ClippingModeType ClippingMode
2847 return (ClippingModeType)GetValue(ClippingModeProperty);
2851 SetValue(ClippingModeProperty, value);
2852 NotifyPropertyChanged();
2857 /// Gets the number of renderers held by the view.
2859 /// <since_tizen> 3 </since_tizen>
2860 public uint RendererCount
2864 return GetRendererCount();
2869 /// This has been deprecated in API5 and will be removed in API8. Use PivotPoint instead.
2872 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2874 /// <since_tizen> 3 </since_tizen>
2875 [Obsolete("This has been deprecated in API5 and will be removed in API8. Use PivotPoint instead. " +
2877 "View view = new View(); " +
2878 "view.PivotPoint = PivotPoint.Center; " +
2879 "view.PositionUsesPivotPoint = true;")]
2880 [EditorBrowsable(EditorBrowsableState.Never)]
2881 public Position AnchorPoint
2885 if (NUIApplication.IsUsingXaml)
2887 return (Position)GetValue(AnchorPointProperty);
2891 return (Position)GetInternalAnchorPointProperty(this);
2898 if (NUIApplication.IsUsingXaml)
2900 SetValue(AnchorPointProperty, value);
2904 SetInternalAnchorPointProperty(this, null, value);
2910 private Position InternalAnchorPoint
2914 return GetCurrentAnchorPoint();
2918 SetAnchorPoint(value);
2919 NotifyPropertyChanged();
2924 /// Sets the size of a view for the width, the height and the depth.<br />
2925 /// Geometry can be scaled to fit within this area.<br />
2926 /// This does not interfere with the view's scale factor.<br />
2927 /// The views default depth is the minimum of width and height.<br />
2931 /// Animatable - This property can be animated using <c>Animation</c> class.
2933 /// animation.AnimateTo(view, "Size", new Size(100, 100));
2936 /// The property cascade chaining set is not recommended.
2939 /// This way is recommended for setting the property
2941 /// var view = new View();
2942 /// view.Size = new Size(100.5f, 200, 0);
2944 /// This way to set the property is prohibited
2946 /// view.Size.Width = 100.5f; //This does not guarantee a proper operation
2949 /// <since_tizen> 5 </since_tizen>
2954 if (NUIApplication.IsUsingXaml)
2956 return (Size)GetValue(SizeProperty);
2960 return (Size)GetInternalSizeProperty(this);
2965 if (NUIApplication.IsUsingXaml)
2967 SetValue(SizeProperty, value);
2971 SetInternalSizeProperty(this, null, value);
2973 NotifyPropertyChanged();
2978 /// This has been deprecated in API5 and will be removed in API8. Use 'Container GetParent() for derived class' instead.
2980 /// <since_tizen> 3 </since_tizen>
2981 [Obsolete("This has been deprecated in API5 and will be removed in API8. Use 'Container GetParent() for derived class' instead. " +
2983 "Container parent = view.GetParent(); " +
2984 "View view = parent as View;")]
2985 [EditorBrowsable(EditorBrowsableState.Never)]
2986 public new View Parent
2991 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2992 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2993 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2995 if (basehandle is Layer layer)
2997 ret = new View(Layer.getCPtr(layer).Handle, false);
2998 NUILog.Error("This Parent property is deprecated, should do not be used");
3002 ret = basehandle as View;
3005 Interop.BaseHandle.DeleteBaseHandle(CPtr);
3006 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
3008 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
3014 /// Gets/Sets whether inherit parent's the layout Direction.
3016 /// <since_tizen> 4 </since_tizen>
3017 public bool InheritLayoutDirection
3021 return (bool)GetValue(InheritLayoutDirectionProperty);
3025 SetValue(InheritLayoutDirectionProperty, value);
3026 NotifyPropertyChanged();
3031 /// Gets/Sets the layout Direction.
3033 /// <since_tizen> 4 </since_tizen>
3034 public ViewLayoutDirectionType LayoutDirection
3038 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
3042 SetValue(LayoutDirectionProperty, value);
3043 NotifyPropertyChanged();
3044 layout?.RequestLayout();
3049 /// Gets or sets the Margin for use in layout.
3052 /// Margin property is supported by Layout algorithms and containers.
3053 /// Please Set Layout if you want to use Margin property.
3054 /// The property cascade chaining set is not recommended.
3057 /// This way is recommended for setting the property
3059 /// var view = new View();
3060 /// view.Margin = new Extents(10, 5, 15, 20);
3062 /// This way to set the property is prohibited
3064 /// view.Margin.Top = 15; //This does not guarantee a proper operation
3067 /// <since_tizen> 4 </since_tizen>
3068 public Extents Margin
3072 if (NUIApplication.IsUsingXaml)
3074 return (Extents)GetValue(MarginProperty);
3078 return (Extents)GetInternalMarginProperty(this);
3084 if (NUIApplication.IsUsingXaml)
3086 SetValue(MarginProperty, value);
3090 SetInternalMarginProperty(this, null, value);
3093 NotifyPropertyChanged();
3098 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
3102 /// // matchParentView matches its size to its parent size.
3103 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
3104 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
3106 /// // wrapContentView wraps its children with their desired size.
3107 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
3108 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
3110 /// // exactSizeView shows itself with an exact size.
3111 /// exactSizeView.WidthSpecification = 100;
3112 /// exactSizeView.HeightSpecification = 100;
3115 /// <since_tizen> 6 </since_tizen>
3116 [Binding.TypeConverter(typeof(IntGraphicsTypeConverter))]
3117 public int WidthSpecification
3121 return (int)GetValue(WidthSpecificationProperty);
3125 SetValue(WidthSpecificationProperty, value);
3126 NotifyPropertyChanged();
3130 private int InternalWidthSpecification
3138 if (value == widthPolicy)
3141 widthPolicy = value;
3142 if (widthPolicy >= 0)
3144 SizeWidth = widthPolicy;
3146 layout?.RequestLayout();
3151 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
3155 /// // matchParentView matches its size to its parent size.
3156 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
3157 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
3159 /// // wrapContentView wraps its children with their desired size.
3160 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
3161 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
3163 /// // exactSizeView shows itself with an exact size.
3164 /// exactSizeView.WidthSpecification = 100;
3165 /// exactSizeView.HeightSpecification = 100;
3168 /// <since_tizen> 6 </since_tizen>
3169 [Binding.TypeConverter(typeof(IntGraphicsTypeConverter))]
3170 public int HeightSpecification
3174 return (int)GetValue(HeightSpecificationProperty);
3178 SetValue(HeightSpecificationProperty, value);
3179 NotifyPropertyChanged();
3183 private int InternalHeightSpecification
3187 return heightPolicy;
3191 if (value == heightPolicy)
3194 heightPolicy = value;
3195 if (heightPolicy >= 0)
3197 SizeHeight = heightPolicy;
3199 layout?.RequestLayout();
3204 /// Gets the List of transitions for this View.
3206 /// <since_tizen> 6 </since_tizen>
3207 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
3211 if (layoutTransitions == null)
3213 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
3215 return layoutTransitions;
3220 /// Sets a layout transitions for this View.
3222 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
3224 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
3226 /// <since_tizen> 6 </since_tizen>
3227 public LayoutTransition LayoutTransition
3231 return GetValue(LayoutTransitionProperty) as LayoutTransition;
3235 SetValue(LayoutTransitionProperty, value);
3236 NotifyPropertyChanged();
3240 private LayoutTransition InternalLayoutTransition
3244 return layoutTransition;
3250 throw new global::System.ArgumentNullException(nameof(value));
3252 if (layoutTransitions == null)
3254 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
3257 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
3259 AttachTransitionsToChildren(value);
3261 layoutTransition = value;
3266 /// This has been deprecated in API5 and will be removed in API8. Use Padding instead.
3269 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
3271 /// <since_tizen> 4 </since_tizen>
3272 [Obsolete("This has been deprecated in API5 and will be removed in API8. Use Padding instead.")]
3273 [EditorBrowsable(EditorBrowsableState.Never)]
3274 public Extents PaddingEX
3278 return GetValue(PaddingEXProperty) as Extents;
3282 SetValue(PaddingEXProperty, value);
3286 private Extents InternalPaddingEX
3290 Extents temp = new Extents(0, 0, 0, 0);
3291 var pValue = GetProperty(View.Property.PADDING);
3294 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
3300 var temp = new Tizen.NUI.PropertyValue(value);
3301 SetProperty(View.Property.PADDING, temp);
3303 NotifyPropertyChanged();
3304 layout?.RequestLayout();
3309 /// The Color of View. This is an RGBA value.
3310 /// Each RGBA components match as <see cref="ColorRed"/>, <see cref="ColorGreen"/>, <see cref="ColorBlue"/>, and <see cref="Opacity"/>.
3311 /// This property will multiply the final color of this view. (BackgroundColor, BorderlineColor, BackgroundImage, etc).
3312 /// For example, if view.BackgroundColor = Color.Yellow and view.Color = Color.Purple, this view will shown as Red.
3313 /// Inherient of color value depend on <see cref="ColorMode"/>.
3317 /// Animatable - This property can be animated using <c>Animation</c> class.
3319 /// The property cascade chaining set is not recommended.
3322 /// This way is recommended for setting the property
3324 /// var view = new View();
3325 /// view.Color = new Color(0.5f, 0.2f, 0.1f, 0.5f);
3327 /// This way to set the property is prohibited
3329 /// view.Color.A = 0.5f; //This does not guarantee a proper operation
3332 [EditorBrowsable(EditorBrowsableState.Never)]
3337 if (NUIApplication.IsUsingXaml)
3339 return (Color)GetValue(ColorProperty);
3343 return (Color)GetInternalColorProperty(this);
3350 if (NUIApplication.IsUsingXaml)
3352 SetValue(ColorProperty, value);
3356 SetInternalColorProperty(this, null, value);
3360 NotifyPropertyChanged();
3365 /// The Red component of View.Color.
3369 /// Animatable - This property can be animated using <c>Animation</c> class.
3372 [EditorBrowsable(EditorBrowsableState.Never)]
3373 public float ColorRed
3377 if (NUIApplication.IsUsingXaml)
3379 return (float)GetValue(ColorRedProperty);
3383 return (float)GetInternalColorRedProperty(this);
3390 if (NUIApplication.IsUsingXaml)
3392 SetValue(ColorRedProperty, value);
3396 SetInternalColorRedProperty(this, null, value);
3400 NotifyPropertyChanged();
3405 /// The Green component of View.Color.
3409 /// Animatable - This property can be animated using <c>Animation</c> class.
3412 [EditorBrowsable(EditorBrowsableState.Never)]
3413 public float ColorGreen
3417 if (NUIApplication.IsUsingXaml)
3419 return (float)GetValue(ColorGreenProperty);
3423 return (float)GetInternalColorGreenProperty(this);
3430 if (NUIApplication.IsUsingXaml)
3432 SetValue(ColorGreenProperty, value);
3436 SetInternalColorGreenProperty(this, null, value);
3440 NotifyPropertyChanged();
3445 /// The Blue component of View.Color.
3449 /// Animatable - This property can be animated using <c>Animation</c> class.
3452 [EditorBrowsable(EditorBrowsableState.Never)]
3453 public float ColorBlue
3457 if (NUIApplication.IsUsingXaml)
3459 return (float)GetValue(ColorBlueProperty);
3463 return (float)GetInternalColorBlueProperty(this);
3470 if (NUIApplication.IsUsingXaml)
3472 SetValue(ColorBlueProperty, value);
3476 SetInternalColorBlueProperty(this, null, value);
3480 NotifyPropertyChanged();
3485 /// Set the layout on this View. Replaces any existing Layout.
3488 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
3490 /// <since_tizen> 6 </since_tizen>
3491 public LayoutItem Layout
3495 return GetValue(LayoutProperty) as LayoutItem;
3499 SetValue(LayoutProperty, value);
3503 private LayoutItem InternalLayout
3511 // Do nothing if layout provided is already set on this View.
3512 if (value == layout)
3517 LayoutingDisabled = false;
3520 // If new layout being set already has a owner then that owner receives a replacement default layout.
3521 // First check if the layout to be set already has a owner.
3522 if (value?.Owner != null)
3524 // Previous owner of the layout gets a default layout as a replacement.
3525 value.Owner.Layout = new AbsoluteLayout()
3527 // Copy Margin and Padding to replacement LayoutGroup.
3528 Margin = value.Margin,
3529 Padding = value.Padding,
3533 // Copy Margin and Padding to new layout being set or restore padding and margin back to
3534 // View if no replacement. Previously margin and padding values would have been moved from
3535 // the View to the layout.
3536 if (layout != null) // Existing layout
3540 // Existing layout being replaced so copy over margin and padding values.
3541 value.Margin = layout.Margin;
3542 value.Padding = layout.Padding;
3543 value.SetPositionByLayout = !excludeLayouting;
3547 // Layout not being replaced so restore margin and padding to View.
3548 SetValue(MarginProperty, layout.Margin);
3549 SetValue(PaddingProperty, layout.Padding);
3550 NotifyPropertyChanged();
3555 // First Layout to be added to the View hence copy
3557 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
3560 Extents margin = Margin;
3561 Extents padding = Padding;
3562 bool setMargin = false;
3563 bool setPadding = false;
3565 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
3567 // If View already has a margin set then store it in Layout instead.
3568 value.Margin = margin;
3569 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
3573 // The calculation of the native size of the text component requires padding.
3574 // Don't overwrite the zero padding.
3575 bool isTextLayout = (value is Tizen.NUI.BaseComponents.TextLabel.TextLabelLayout) ||
3576 (value is Tizen.NUI.BaseComponents.TextField.TextFieldLayout) ||
3577 (value is Tizen.NUI.BaseComponents.TextEditor.TextEditorLayout);
3579 if (!isTextLayout && (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0))
3581 // If View already has a padding set then store it in Layout instead.
3582 value.Padding = padding;
3583 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
3587 if (setMargin || setPadding)
3589 NotifyPropertyChanged();
3592 value.SetPositionByLayout = !excludeLayouting;
3596 // Remove existing layout from it's parent layout group.
3599 // Set layout to this view
3605 /// The weight of the View, used to share available space in a layout with siblings.
3607 /// <since_tizen> 6 </since_tizen>
3617 layout?.RequestLayout();
3622 /// Whether to load the BackgroundImage synchronously.
3623 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
3624 /// Note: For Normal Quad images only.
3626 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
3627 [EditorBrowsable(EditorBrowsableState.Never)]
3628 public bool BackgroundImageSynchronosLoading
3632 return (bool)GetValue(BackgroundImageSynchronosLoadingProperty);
3636 SetValue(BackgroundImageSynchronosLoadingProperty, value);
3637 NotifyPropertyChanged();
3641 private bool InternalBackgroundImageSynchronosLoading
3645 return BackgroundImageSynchronousLoading;
3649 BackgroundImageSynchronousLoading = value;
3654 /// Whether to load the BackgroundImage synchronously.
3655 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
3656 /// Note: For Normal Quad images only.
3658 /// This will be public opened in tizen_7.0 after ACR done. Before ACR, need to be hidden as inhouse API.
3659 [EditorBrowsable(EditorBrowsableState.Never)]
3660 public bool BackgroundImageSynchronousLoading
3664 return (bool)GetValue(BackgroundImageSynchronousLoadingProperty);
3668 SetValue(BackgroundImageSynchronousLoadingProperty, value);
3669 NotifyPropertyChanged();
3673 private bool InternalBackgroundImageSynchronousLoading
3677 return backgroundImageSynchronousLoading;
3681 backgroundImageSynchronousLoading = value;
3683 if (!string.IsNullOrEmpty(BackgroundImage))
3685 PropertyMap bgMap = this.Background;
3686 var temp = new PropertyValue(backgroundImageSynchronousLoading);
3687 bgMap[ImageVisualProperty.SynchronousLoading] = temp;
3694 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
3695 [EditorBrowsable(EditorBrowsableState.Never)]
3696 public Vector4 UpdateAreaHint
3700 return (Vector4)GetValue(UpdateAreaHintProperty);
3704 SetValue(UpdateAreaHintProperty, value);
3705 NotifyPropertyChanged();
3710 /// Enable/Disable ControlState propagation for children.
3711 /// It is false by default.
3712 /// If the View needs to share ControlState with descendants, please set it true.
3713 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
3715 [EditorBrowsable(EditorBrowsableState.Never)]
3716 public bool EnableControlStatePropagation
3720 return (bool)GetValue(EnableControlStatePropagationProperty);
3724 SetValue(EnableControlStatePropagationProperty, value);
3725 NotifyPropertyChanged();
3729 private bool InternalEnableControlStatePropagation
3731 get => themeData?.ControlStatePropagation ?? false;
3734 if (InternalEnableControlStatePropagation == value) return;
3736 if (themeData == null) themeData = new ThemeData();
3738 themeData.ControlStatePropagation = value;
3740 foreach (View child in Children)
3742 child.EnableControlStatePropagation = value;
3748 /// The ControlStates can propagate from the parent.
3749 /// Listed ControlStates will be accepted propagation of the parent ControlState changes
3750 /// if parent view EnableControlState is true.
3751 /// <see cref="EnableControlState"/>.
3752 /// Default is ControlState.All, so every ControlStates will be propagated from the parent.
3754 [EditorBrowsable(EditorBrowsableState.Never)]
3755 public ControlState PropagatableControlStates
3759 return (ControlState)GetValue(PropagatableControlStatesProperty);
3763 SetValue(PropagatableControlStatesProperty, value);
3764 NotifyPropertyChanged();
3768 private ControlState InternalPropagatableControlStates
3770 get => propagatableControlStates;
3771 set => propagatableControlStates = value;
3775 /// By default, it is false in View, true in Control.
3776 /// Note that if the value is true, the View will be a touch receptor.
3778 [EditorBrowsable(EditorBrowsableState.Never)]
3779 public bool EnableControlState
3783 return (bool)GetValue(EnableControlStateProperty);
3787 SetValue(EnableControlStateProperty, value);
3792 /// Whether the actor grab all touches even if touch leaves its boundary.
3794 /// <returns>true, if it grab all touch after start</returns>
3795 [EditorBrowsable(EditorBrowsableState.Never)]
3796 public bool GrabTouchAfterLeave
3800 return (bool)GetValue(GrabTouchAfterLeaveProperty);
3804 SetValue(GrabTouchAfterLeaveProperty, value);
3808 private bool InternalGrabTouchAfterLeave
3812 return Object.InternalGetPropertyBool(SwigCPtr, View.Property.CaptureAllTouchAfterStart);
3816 Object.InternalSetPropertyBool(SwigCPtr, View.Property.CaptureAllTouchAfterStart, value);
3818 // Use custom HitTest callback only if GrabTouchAfterLeave is true.
3821 RegisterHitTestCallback();
3825 UnregisterHitTestCallback();
3828 NotifyPropertyChanged();
3833 /// Whether the view will only receive own touch.
3835 /// <returns>true, if it only receives touches that started from itself.</returns>
3836 [EditorBrowsable(EditorBrowsableState.Never)]
3837 public bool AllowOnlyOwnTouch
3841 return (bool)GetValue(AllowOnlyOwnTouchProperty);
3845 SetValue(AllowOnlyOwnTouchProperty, value);
3849 private bool InternalAllowOnlyOwnTouch
3853 return Object.InternalGetPropertyBool(SwigCPtr, View.Property.AllowOnlyOwnTouch);
3857 Object.InternalSetPropertyBool(SwigCPtr, View.Property.AllowOnlyOwnTouch, value);
3858 NotifyPropertyChanged();
3863 /// Determines which blend equation will be used to render renderers of this actor.
3865 /// <returns>blend equation enum currently assigned</returns>
3866 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
3867 [EditorBrowsable(EditorBrowsableState.Never)]
3868 public BlendEquationType BlendEquation
3872 return (BlendEquationType)GetValue(BlendEquationProperty);
3876 SetValue(BlendEquationProperty, value);
3880 private BlendEquationType InternalBlendEquation
3884 return (BlendEquationType)Object.InternalGetPropertyInt(SwigCPtr, View.Property.BlendEquation);
3888 Object.InternalSetPropertyInt(SwigCPtr, View.Property.BlendEquation, (int)value);
3889 NotifyPropertyChanged();
3894 /// If the value is true, the View will change its style as the theme changes.
3895 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
3897 /// <since_tizen> 9 </since_tizen>
3898 public bool ThemeChangeSensitive
3900 get => (bool)GetValue(ThemeChangeSensitiveProperty);
3901 set => SetValue(ThemeChangeSensitiveProperty, value);
3905 /// Create Style, it is abstract function and must be override.
3907 [EditorBrowsable(EditorBrowsableState.Never)]
3908 protected virtual ViewStyle CreateViewStyle()
3910 return new ViewStyle();
3914 /// Called after the View's ControlStates changed.
3916 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
3917 [EditorBrowsable(EditorBrowsableState.Never)]
3918 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
3924 [EditorBrowsable(EditorBrowsableState.Never)]
3925 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
3927 isThemeChanged = true;
3928 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
3929 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
3930 isThemeChanged = false;
3934 /// Apply style instance to the view.
3935 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
3937 /// <since_tizen> 9 </since_tizen>
3938 public virtual void ApplyStyle(ViewStyle viewStyle)
3940 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
3942 if (themeData == null) themeData = new ThemeData();
3944 themeData.viewStyle = viewStyle;
3946 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
3952 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
3954 if (bindablePropertyOfView == null)
3959 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
3960 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
3962 foreach (var sourceProperty in dirtyStyleProperties)
3964 var sourceValue = viewStyle.GetValue(sourceProperty);
3966 if (sourceValue == null)
3971 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
3973 // Do not set value again when theme is changed and the value has been set already.
3974 if (isThemeChanged && ChangedPropertiesSetExcludingStyle.Contains(destinationProperty))
3979 if (destinationProperty != null)
3981 InternalSetValue(destinationProperty, sourceValue);
3987 /// Get whether the View is culled or not.
3988 /// True means that the View is out of the view frustum.
3991 /// Hidden-API (Inhouse-API).
3993 [EditorBrowsable(EditorBrowsableState.Never)]
3998 return Object.InternalGetPropertyBool(SwigCPtr, View.Property.Culled);
4003 /// Set or Get TransitionOptions for the page transition.
4004 /// This property is used to define how this view will be transitioned during Page switching.
4006 /// <since_tizen> 9 </since_tizen>
4007 public TransitionOptions TransitionOptions
4011 return GetValue(TransitionOptionsProperty) as TransitionOptions;
4015 SetValue(TransitionOptionsProperty, value);
4016 NotifyPropertyChanged();
4020 private TransitionOptions InternalTransitionOptions
4024 transitionOptions = value;
4028 return transitionOptions;
4033 /// Called when the view is hit through TouchEvent or GestureEvent.
4034 /// If it returns true, it means that it was hit, and the touch/gesture event is called from the view.
4035 /// If it returns false, it means that it will not be hit, and the hit-test continues to the next view.
4036 /// User can override whether hit or not in HitTest.
4037 /// You can get the coordinates relative to tthe top-left of the hit view by touch.GetLocalPosition(0).
4038 /// or you can get the coordinates relative to the top-left of the screen by touch.GetScreenPosition(0).
4040 // <param name="touch"><see cref="Tizen.NUI.Touch"/>The touch data</param>
4041 [EditorBrowsable(EditorBrowsableState.Never)]
4042 protected virtual bool HitTest(Touch touch)
4048 /// Retrieve the View's current Color.
4051 /// The <see cref="Size"/>, <see cref="Position"/>, <see cref="Color"/>, and <see cref="Scale"/> properties are set in the main thread.
4052 /// Therefore, it is not updated in real time when the value is changed in the render thread (for example, the value is changed during animation).
4053 /// However, <see cref="CurrentSize"/>, <see cref="CurrentPosition"/>, <see cref="CurrentColor"/>, and <see cref="CurrentScale"/> properties are updated in real time,
4054 /// and users can get the current actual values through them.
4056 [EditorBrowsable(EditorBrowsableState.Never)]
4057 public Color CurrentColor => GetCurrentColor();
4060 /// Retrieve the current scale factor applied to the View.
4063 /// The <see cref="Size"/>, <see cref="Position"/>, <see cref="Color"/>, and <see cref="Scale"/> properties are set in the main thread.
4064 /// Therefore, it is not updated in real time when the value is changed in the render thread (for example, the value is changed during animation).
4065 /// However, <see cref="CurrentSize"/>, <see cref="CurrentPosition"/>, <see cref="CurrentColor"/>, and <see cref="CurrentScale"/> properties are updated in real time,
4066 /// and users can get the current actual values through them.
4068 [EditorBrowsable(EditorBrowsableState.Never)]
4069 public Vector3 CurrentScale => GetCurrentScale();
4072 /// Gets the number of currently alived View object.
4074 [EditorBrowsable(EditorBrowsableState.Never)]
4075 public static int AliveCount => aliveCount;
4078 /// Voice interaction name for voice touch.
4080 [EditorBrowsable(EditorBrowsableState.Never)]
4081 public string VoiceInteractionName
4085 AutomationId = value;
4089 return AutomationId;