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 backgroundImageSynchronousLoading = 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;
55 private Size2D internalSize2D = null;
59 RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
60 RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
61 RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
62 RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);
64 RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
65 RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
66 RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
67 RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);
69 RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
70 RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
71 RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
72 RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
76 /// Creates a new instance of a view.
78 /// <since_tizen> 3 </since_tizen>
79 public View() : this(Interop.View.New(), true)
81 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
84 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
85 [EditorBrowsable(EditorBrowsableState.Never)]
86 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
91 /// Create a new instance of a View with setting the status of shown or hidden.
93 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
94 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
95 [EditorBrowsable(EditorBrowsableState.Never)]
96 public View(bool shown) : this(Interop.View.New(), true)
98 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
113 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
115 InitializeStyle(viewStyle);
118 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
122 PositionUsesPivotPoint = false;
125 onWindowSendEventCallback = SendViewAddedEventToWindow;
126 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
127 signal?.Connect(onWindowSendEventCallback);
135 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
137 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146 /// The event that is triggered when the View's ControlState is changed.
148 [EditorBrowsable(EditorBrowsableState.Never)]
149 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
151 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
155 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
157 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
158 [EditorBrowsable(EditorBrowsableState.Never)]
159 public bool LayoutSet
168 /// Flag to allow Layouting to be disabled for Views.
169 /// Once a View has a Layout set then any children added to Views from then on will receive
170 /// automatic Layouts.
172 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
173 [EditorBrowsable(EditorBrowsableState.Never)]
174 public static bool LayoutingDisabled { get; set; } = true;
177 /// Deprecate. Please do not use this.
178 /// The style instance applied to this view.
179 /// Note that please do not modify the ViewStyle.
180 /// Modifying ViewStyle will affect other views with same ViewStyle.
182 [EditorBrowsable(EditorBrowsableState.Never)]
183 protected ViewStyle ViewStyle
187 if (themeData == null) themeData = new ThemeData();
189 if (themeData.viewStyle == null)
191 ApplyStyle(CreateViewStyle());
193 return themeData.viewStyle;
198 /// Get/Set the control state.
199 /// Note that the ControlState only available for the classes derived from Control.
200 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
201 /// please set <see cref="EnableControlState"/> to true.
203 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
204 [EditorBrowsable(EditorBrowsableState.Never)]
205 public ControlState ControlState
209 return themeData == null ? ControlState.Normal : themeData.controlStates;
213 if (ControlState == value)
218 var prevState = ControlState;
220 if (themeData == null) themeData = new ThemeData();
221 themeData.controlStates = value;
223 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
225 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
227 if (themeData.ControlStatePropagation)
229 foreach (View child in Children)
231 child.ControlState = value;
235 OnControlStateChanged(changeInfo);
237 ControlStateChangedEvent?.Invoke(this, changeInfo);
242 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
244 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
245 [EditorBrowsable(EditorBrowsableState.Never)]
246 public bool ExcludeLayouting
250 return (bool)GetValue(ExcludeLayoutingProperty);
254 SetValue(ExcludeLayoutingProperty, value);
255 NotifyPropertyChanged();
259 private bool InternalExcludeLayouting
263 return excludeLayouting;
267 excludeLayouting = value;
268 if (Layout != null && Layout.SetPositionByLayout == value)
270 Layout.SetPositionByLayout = !value;
271 Layout.RequestLayout();
276 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
277 [EditorBrowsable(EditorBrowsableState.Never)]
278 public bool IsResourcesCreated
282 return Application.Current.IsResourcesCreated;
286 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
287 [EditorBrowsable(EditorBrowsableState.Never)]
288 public ResourceDictionary XamlResources
292 return Application.Current.XamlResources;
296 Application.Current.XamlResources = value;
301 /// The StyleName, type string.
302 /// The value indicates DALi style name defined in json theme file.
304 /// <since_tizen> 3 </since_tizen>
305 public string StyleName
309 return (string)GetValue(StyleNameProperty);
313 SetValue(StyleNameProperty, value);
314 NotifyPropertyChanged();
319 /// The KeyInputFocus, type bool.
321 [EditorBrowsable(EditorBrowsableState.Never)]
322 public bool KeyInputFocus
326 return (bool)GetValue(KeyInputFocusProperty);
330 SetValue(KeyInputFocusProperty, value);
331 NotifyPropertyChanged();
336 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
340 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
343 /// Animatable - This property can be animated using <c>Animation</c> class.
345 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
349 /// <since_tizen> 3 </since_tizen>
350 public Color BackgroundColor
354 Color temp = (Color)GetValue(BackgroundColorProperty);
355 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
359 SetValue(BackgroundColorProperty, value);
360 NotifyPropertyChanged();
365 /// The mutually exclusive with "backgroundColor" and "background" type Map.
367 /// <since_tizen> 3 </since_tizen>
368 public string BackgroundImage
372 return (string)GetValue(BackgroundImageProperty);
376 SetValue(BackgroundImageProperty, value);
377 NotifyPropertyChanged();
382 /// Get or set the border of background image.
384 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
385 [EditorBrowsable(EditorBrowsableState.Never)]
386 public Rectangle BackgroundImageBorder
390 return (Rectangle)GetValue(BackgroundImageBorderProperty);
394 SetValue(BackgroundImageBorderProperty, value);
395 NotifyPropertyChanged();
400 /// The background of view.
402 /// <since_tizen> 3 </since_tizen>
403 public Tizen.NUI.PropertyMap Background
407 return (PropertyMap)GetValue(BackgroundProperty);
411 SetValue(BackgroundProperty, value);
412 NotifyPropertyChanged();
417 /// Describes a shadow as an image for a View.
418 /// It is null by default.
421 /// Getter returns copied instance of current shadow.
424 /// The mutually exclusive with "BoxShadow".
428 /// Animatable - This property can be animated using <c>Animation</c> class.
429 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
431 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
433 /// Animatable sub-property : Offset.
436 [EditorBrowsable(EditorBrowsableState.Never)]
437 public ImageShadow ImageShadow
441 return (ImageShadow)GetValue(ImageShadowProperty);
445 SetValue(ImageShadowProperty, value);
446 NotifyPropertyChanged();
451 /// Describes a box shaped shadow drawing for a View.
452 /// It is null by default.
455 /// The mutually exclusive with "ImageShadow".
459 /// Animatable - This property can be animated using <c>Animation</c> class.
460 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
462 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
464 /// Animatable sub-property : Offset, Color, BlurRadius.
467 /// <since_tizen> 9 </since_tizen>
468 public Shadow BoxShadow
472 return (Shadow)GetValue(BoxShadowProperty);
476 SetValue(BoxShadowProperty, value);
477 NotifyPropertyChanged();
482 /// The radius for the rounded corners of the View.
483 /// This will rounds background and shadow edges.
484 /// 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).
485 /// Each radius will clamp internally to the half of smaller of the view's width or height.
486 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
490 /// Animatable - This property can be animated using <c>Animation</c> class.
492 /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10));
496 /// <since_tizen> 9 </since_tizen>
497 public Vector4 CornerRadius
501 return (Vector4)GetValue(CornerRadiusProperty);
505 SetValue(CornerRadiusProperty, value);
506 NotifyPropertyChanged();
511 /// Whether the CornerRadius property value is relative (percentage [0.0f to 0.5f] of the view size) or absolute (in world units).
512 /// It is absolute by default.
513 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
515 /// <since_tizen> 9 </since_tizen>
516 public VisualTransformPolicyType CornerRadiusPolicy
518 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
519 set => SetValue(CornerRadiusPolicyProperty, value);
523 /// The width for the borderline of the View.
527 /// Animatable - This property can be animated using <c>Animation</c> class.
529 /// animation.AnimateTo(view, "BorderlineWidth", 100.0f);
532 /// Note that, an image background may not have borderline if it uses the Border property.
534 /// <since_tizen> 9 </since_tizen>
535 public float BorderlineWidth
539 return (float)GetValue(BorderlineWidthProperty);
543 SetValue(BorderlineWidthProperty, value);
544 NotifyPropertyChanged();
549 /// The color for the borderline of the View.
550 /// It is Color.Black by default.
554 /// Animatable - This property can be animated using <c>Animation</c> class.
556 /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a));
560 /// <since_tizen> 9 </since_tizen>
561 public Color BorderlineColor
565 return (Color)GetValue(BorderlineColorProperty);
569 SetValue(BorderlineColorProperty, value);
570 NotifyPropertyChanged();
575 /// The Relative offset for the borderline of the View.
576 /// Recommended range : [-1.0f to 1.0f].
577 /// If -1.0f, draw borderline inside of the View.
578 /// If 1.0f, draw borderline outside of the View.
579 /// If 0.0f, draw borderline half inside and half outside.
580 /// It is 0.0f by default.
584 /// Animatable - This property can be animated using <c>Animation</c> class.
586 /// animation.AnimateTo(view, "BorderlineOffset", -1.0f);
590 /// <since_tizen> 9 </since_tizen>
591 public float BorderlineOffset
595 return (float)GetValue(BorderlineOffsetProperty);
599 SetValue(BorderlineOffsetProperty, value);
600 NotifyPropertyChanged();
605 /// The current state of the view.
607 /// <since_tizen> 3 </since_tizen>
612 return (States)GetValue(StateProperty);
616 SetValue(StateProperty, value);
617 NotifyPropertyChanged();
622 /// The current sub state of the view.
624 /// <since_tizen> 3 </since_tizen>
625 public States SubState
629 return (States)GetValue(SubStateProperty);
633 SetValue(SubStateProperty, value);
634 NotifyPropertyChanged();
639 /// Displays a tooltip
641 /// <since_tizen> 3 </since_tizen>
642 public Tizen.NUI.PropertyMap Tooltip
646 return (PropertyMap)GetValue(TooltipProperty);
650 SetValue(TooltipProperty, value);
651 NotifyPropertyChanged();
656 /// Displays a tooltip as a text.
658 /// <since_tizen> 3 </since_tizen>
659 public string TooltipText
663 return GetValue(TooltipTextProperty) as string;
667 SetValue(TooltipTextProperty, value);
671 private string InternalTooltipText
675 using (var propertyValue = GetProperty(Property.TOOLTIP))
677 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
679 return retrivedValue;
681 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
682 return "error to get TooltipText";
687 var temp = new Tizen.NUI.PropertyValue(value);
688 SetProperty(View.Property.TOOLTIP, temp);
690 NotifyPropertyChanged();
695 /// The Child property of FlexContainer.<br />
696 /// The proportion of the free space in the container, the flex item will receive.<br />
697 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
699 /// <since_tizen> 3 </since_tizen>
700 [Obsolete("Deprecated in API8, will be removed in API10.")]
705 return (float)GetValue(FlexProperty);
709 SetValue(FlexProperty, value);
710 NotifyPropertyChanged();
715 /// The Child property of FlexContainer.<br />
716 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
718 /// <since_tizen> 3 </since_tizen>
719 [Obsolete("Deprecated in API8, will be removed in API10.")]
724 return (int)GetValue(AlignSelfProperty);
728 SetValue(AlignSelfProperty, value);
729 NotifyPropertyChanged();
734 /// The Child property of FlexContainer.<br />
735 /// The space around the flex item.<br />
738 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
740 /// <since_tizen> 3 </since_tizen>
741 [Obsolete("Deprecated in API8, will be removed in API10.")]
742 public Vector4 FlexMargin
746 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
747 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
751 SetValue(FlexMarginProperty, value);
752 NotifyPropertyChanged();
757 /// The top-left cell this child occupies, if not set, the first available cell is used.
760 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
761 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
763 /// <since_tizen> 3 </since_tizen>
764 public Vector2 CellIndex
768 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
769 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
773 SetValue(CellIndexProperty, value);
774 NotifyPropertyChanged();
779 /// The number of rows this child occupies, if not set, the default value is 1.
782 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
784 /// <since_tizen> 3 </since_tizen>
789 return (float)GetValue(RowSpanProperty);
793 SetValue(RowSpanProperty, value);
794 NotifyPropertyChanged();
799 /// The number of columns this child occupies, if not set, the default value is 1.
802 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
804 /// <since_tizen> 3 </since_tizen>
805 public float ColumnSpan
809 return (float)GetValue(ColumnSpanProperty);
813 SetValue(ColumnSpanProperty, value);
814 NotifyPropertyChanged();
819 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
822 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
824 /// <since_tizen> 3 </since_tizen>
825 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
829 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
833 SetValue(CellHorizontalAlignmentProperty, value);
834 NotifyPropertyChanged();
839 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
842 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
844 /// <since_tizen> 3 </since_tizen>
845 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
849 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
853 SetValue(CellVerticalAlignmentProperty, value);
854 NotifyPropertyChanged();
859 /// The left focusable view.<br />
860 /// This will return null if not set.<br />
861 /// This will also return null if the specified left focusable view is not on a window.<br />
863 /// <since_tizen> 3 </since_tizen>
864 public View LeftFocusableView
866 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
869 return (View)GetValue(LeftFocusableViewProperty);
873 SetValue(LeftFocusableViewProperty, value);
874 NotifyPropertyChanged();
879 /// The right focusable view.<br />
880 /// This will return null if not set.<br />
881 /// This will also return null if the specified right focusable view is not on a window.<br />
883 /// <since_tizen> 3 </since_tizen>
884 public View RightFocusableView
886 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
889 return (View)GetValue(RightFocusableViewProperty);
893 SetValue(RightFocusableViewProperty, value);
894 NotifyPropertyChanged();
899 /// The up focusable view.<br />
900 /// This will return null if not set.<br />
901 /// This will also return null if the specified up focusable view is not on a window.<br />
903 /// <since_tizen> 3 </since_tizen>
904 public View UpFocusableView
906 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
909 return (View)GetValue(UpFocusableViewProperty);
913 SetValue(UpFocusableViewProperty, value);
914 NotifyPropertyChanged();
919 /// The down focusable view.<br />
920 /// This will return null if not set.<br />
921 /// This will also return null if the specified down focusable view is not on a window.<br />
923 /// <since_tizen> 3 </since_tizen>
924 public View DownFocusableView
926 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
929 return (View)GetValue(DownFocusableViewProperty);
933 SetValue(DownFocusableViewProperty, value);
934 NotifyPropertyChanged();
939 /// Whether the view should be focusable by keyboard navigation.
941 /// <since_tizen> 3 </since_tizen>
942 public bool Focusable
946 SetValue(FocusableProperty, value);
947 NotifyPropertyChanged();
951 return (bool)GetValue(FocusableProperty);
956 /// 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.
957 /// Note : Default value is true.
959 [EditorBrowsable(EditorBrowsableState.Never)]
960 public bool FocusableChildren
964 SetValue(FocusableChildrenProperty, value);
965 NotifyPropertyChanged();
969 return (bool)GetValue(FocusableChildrenProperty);
974 /// Whether this view can focus by touch.
975 /// If Focusable is false, FocusableInTouch is disabled.
976 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
978 [EditorBrowsable(EditorBrowsableState.Never)]
979 public bool FocusableInTouch
983 SetValue(FocusableInTouchProperty, value);
984 NotifyPropertyChanged();
988 return (bool)GetValue(FocusableInTouchProperty);
993 /// Retrieves the position of the view.<br />
994 /// The coordinates are relative to the view's parent.<br />
996 /// <since_tizen> 3 </since_tizen>
997 public Position CurrentPosition
1001 return GetCurrentPosition();
1006 /// Sets the size of a view for the width and the height.<br />
1007 /// Geometry can be scaled to fit within this area.<br />
1008 /// This does not interfere with the view's scale factor.<br />
1009 /// The views default depth is the minimum of width and height.<br />
1012 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1013 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1015 /// <since_tizen> 3 </since_tizen>
1016 public Size2D Size2D
1020 var temp = (Size2D)GetValue(Size2DProperty);
1022 if (this.Layout == null)
1024 if (temp.Width < 0) { temp.Width = 0; }
1025 if (temp.Height < 0) { temp.Height = 0; }
1032 SetValue(Size2DProperty, value);
1034 NotifyPropertyChanged();
1039 /// Retrieves the size of the view.<br />
1040 /// The coordinates are relative to the view's parent.<br />
1042 /// <since_tizen> 3 </since_tizen>
1043 public Size2D CurrentSize
1047 return GetCurrentSize();
1052 /// Retrieves and sets the view's opacity.<br />
1056 /// Animatable - This property can be animated using <c>Animation</c> class.
1058 /// animation.AnimateTo(view, "Opacity", 0.5f);
1062 /// <since_tizen> 3 </since_tizen>
1063 public float Opacity
1067 return (float)GetValue(OpacityProperty);
1071 SetValue(OpacityProperty, value);
1072 NotifyPropertyChanged();
1077 /// Sets the position of the view for X and Y.<br />
1078 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1079 /// If the position inheritance is disabled, sets the world position.<br />
1082 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1083 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1085 /// <since_tizen> 3 </since_tizen>
1086 public Position2D Position2D
1090 Position2D temp = (Position2D)GetValue(Position2DProperty);
1091 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1095 SetValue(Position2DProperty, value);
1096 NotifyPropertyChanged();
1101 /// Retrieves the screen position of the view.<br />
1103 /// <since_tizen> 3 </since_tizen>
1104 public Vector2 ScreenPosition
1108 Vector2 temp = new Vector2(0.0f, 0.0f);
1109 var pValue = GetProperty(View.Property.ScreenPosition);
1117 /// Determines whether the pivot point should be used to determine the position of the view.
1118 /// This is false by default.
1120 /// <remarks>If false, then the top-left of the view is used for the position.
1121 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1123 /// <since_tizen> 3 </since_tizen>
1124 public bool PositionUsesPivotPoint
1128 return (bool)GetValue(PositionUsesPivotPointProperty);
1132 SetValue(PositionUsesPivotPointProperty, value);
1133 NotifyPropertyChanged();
1138 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1140 /// <since_tizen> 3 </since_tizen>
1141 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1143 "View view = new View(); " +
1144 "view.PivotPoint = PivotPoint.Center; " +
1145 "view.PositionUsesPivotPoint = true;" +
1146 " Deprecated in API5: Will be removed in API8")]
1147 [EditorBrowsable(EditorBrowsableState.Never)]
1148 public bool PositionUsesAnchorPoint
1152 return (bool)GetValue(PositionUsesAnchorPointProperty);
1156 SetValue(PositionUsesAnchorPointProperty, value);
1160 private bool InternalPositionUsesAnchorPoint
1165 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1166 pValue.Get(out temp);
1172 var temp = new Tizen.NUI.PropertyValue(value);
1173 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1175 NotifyPropertyChanged();
1180 /// Queries whether the view is connected to the stage.<br />
1181 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1183 /// <since_tizen> 3 </since_tizen>
1184 public bool IsOnWindow
1193 /// Gets the depth in the hierarchy for the view.
1195 /// <since_tizen> 3 </since_tizen>
1196 public int HierarchyDepth
1200 return GetHierarchyDepth();
1205 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1208 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1209 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1210 /// The values set by this property will likely change.
1212 /// <since_tizen> 3 </since_tizen>
1213 public int SiblingOrder
1217 return (int)GetValue(SiblingOrderProperty);
1221 SetValue(SiblingOrderProperty, value);
1223 Layout?.ChangeLayoutSiblingOrder(value);
1225 NotifyPropertyChanged();
1230 /// Returns the natural size of the view.
1233 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1235 /// <since_tizen> 5 </since_tizen>
1236 public Vector3 NaturalSize
1240 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1247 /// Returns the natural size (Size2D) of the view.
1250 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1252 /// <since_tizen> 4 </since_tizen>
1253 public Size2D NaturalSize2D
1257 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1258 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1260 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1267 /// Gets or sets the origin of a view within its parent's area.<br />
1268 /// 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 />
1269 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1270 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1272 /// <pre>The view has been initialized.</pre>
1273 /// <since_tizen> 3 </since_tizen>
1274 public Position ParentOrigin
1278 Position tmp = (Position)GetValue(ParentOriginProperty);
1279 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1283 SetValue(ParentOriginProperty, value);
1284 NotifyPropertyChanged();
1289 /// Gets or sets the anchor-point of a view.<br />
1290 /// 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 />
1291 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1292 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1293 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1294 /// <pre>The view has been initialized.</pre>
1297 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1299 /// <since_tizen> 3 </since_tizen>
1300 public Position PivotPoint
1304 Position tmp = (Position)GetValue(PivotPointProperty);
1305 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1309 SetValue(PivotPointProperty, value);
1310 NotifyPropertyChanged();
1315 /// Gets or sets the size width of the view.
1319 /// Animatable - This property can be animated using <c>Animation</c> class.
1321 /// animation.AnimateTo(view, "SizeWidth", 500.0f);
1325 /// <since_tizen> 3 </since_tizen>
1326 public float SizeWidth
1330 return (float)GetValue(SizeWidthProperty);
1334 SetValue(SizeWidthProperty, value);
1335 NotifyPropertyChanged();
1340 /// Gets or sets the size height of the view.
1344 /// Animatable - This property can be animated using <c>Animation</c> class.
1347 /// animation.AnimateTo(view, "SizeHeight", 500.0f);
1350 /// <since_tizen> 3 </since_tizen>
1351 public float SizeHeight
1355 return (float)GetValue(SizeHeightProperty);
1359 SetValue(SizeHeightProperty, value);
1360 NotifyPropertyChanged();
1365 /// Gets or sets the position of the view.<br />
1366 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1367 /// If the position inheritance is disabled, sets the world position.<br />
1371 /// Animatable - This property can be animated using <c>Animation</c> class.
1373 /// animation.AnimateTo(view, "Position", new Position(50, 0));
1376 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1378 /// <since_tizen> 3 </since_tizen>
1379 public Position Position
1383 Position tmp = (Position)GetValue(PositionProperty);
1384 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1388 SetValue(PositionProperty, value);
1389 NotifyPropertyChanged();
1394 /// Gets or sets the position X of the view.
1398 /// Animatable - This property can be animated using <c>Animation</c> class.
1400 /// animation.AnimateTo(view, "PositionX", 50.0f);
1404 /// <since_tizen> 3 </since_tizen>
1405 public float PositionX
1409 return (float)GetValue(PositionXProperty);
1413 SetValue(PositionXProperty, value);
1414 NotifyPropertyChanged();
1419 /// Gets or sets the position Y of the view.
1423 /// Animatable - This property can be animated using <c>Animation</c> class.
1425 /// animation.AnimateTo(view, "PositionY", 50.0f);
1429 /// <since_tizen> 3 </since_tizen>
1430 public float PositionY
1434 return (float)GetValue(PositionYProperty);
1438 SetValue(PositionYProperty, value);
1439 NotifyPropertyChanged();
1444 /// Gets or sets the position Z of the view.
1448 /// Animatable - This property can be animated using <c>Animation</c> class.
1450 /// animation.AnimateTo(view, "PositionZ", 50.0f);
1454 /// <since_tizen> 3 </since_tizen>
1455 public float PositionZ
1459 return (float)GetValue(PositionZProperty);
1463 SetValue(PositionZProperty, value);
1464 NotifyPropertyChanged();
1469 /// Gets or sets the world position of the view.
1471 /// <since_tizen> 3 </since_tizen>
1472 public Vector3 WorldPosition
1476 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1477 var pValue = GetProperty(View.Property.WorldPosition);
1485 /// Gets or sets the orientation of the view.<br />
1486 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1490 /// This is an asynchronous method.
1493 /// Animatable - This property can be animated using <c>Animation</c> class.
1495 /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis));
1499 /// <since_tizen> 3 </since_tizen>
1500 public Rotation Orientation
1504 return (Rotation)GetValue(OrientationProperty);
1508 SetValue(OrientationProperty, value);
1509 NotifyPropertyChanged();
1514 /// Gets or sets the world orientation of the view.<br />
1516 /// <since_tizen> 3 </since_tizen>
1517 public Rotation WorldOrientation
1521 Rotation temp = new Rotation();
1522 var pValue = GetProperty(View.Property.WorldOrientation);
1530 /// Gets or sets the scale factor applied to the view.<br />
1534 /// Animatable - This property can be animated using <c>Animation</c> class.
1536 /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f));
1539 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1541 /// <since_tizen> 3 </since_tizen>
1542 public Vector3 Scale
1546 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1547 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1551 SetValue(ScaleProperty, value);
1552 NotifyPropertyChanged();
1557 /// Gets or sets the scale X factor applied to the view.
1561 /// Animatable - This property can be animated using <c>Animation</c> class.
1563 /// animation.AnimateTo(view, "ScaleX", 1.5f);
1567 /// <since_tizen> 3 </since_tizen>
1572 return (float)GetValue(ScaleXProperty);
1576 SetValue(ScaleXProperty, value);
1577 NotifyPropertyChanged();
1582 /// Gets or sets the scale Y factor applied to the view.
1586 /// Animatable - This property can be animated using <c>Animation</c> class.
1588 /// animation.AnimateTo(view, "ScaleY", 1.5f);
1592 /// <since_tizen> 3 </since_tizen>
1597 return (float)GetValue(ScaleYProperty);
1601 SetValue(ScaleYProperty, value);
1602 NotifyPropertyChanged();
1607 /// Gets or sets the scale Z factor applied to the view.
1611 /// Animatable - This property can be animated using <c>Animation</c> class.
1613 /// animation.AnimateTo(view, "ScaleZ", 1.5f);
1617 /// <since_tizen> 3 </since_tizen>
1622 return (float)GetValue(ScaleZProperty);
1626 SetValue(ScaleZProperty, value);
1627 NotifyPropertyChanged();
1632 /// Gets the world scale of the view.
1634 /// <since_tizen> 3 </since_tizen>
1635 public Vector3 WorldScale
1639 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1640 var pValue = GetProperty(View.Property.WorldScale);
1648 /// Retrieves the visibility flag of the view.
1652 /// If the view is not visible, then the view and its children will not be rendered.
1653 /// 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.
1656 /// Animatable - This property can be animated using <c>Animation</c> class.
1658 /// animation.AnimateTo(view, "Visibility", false);
1662 /// <since_tizen> 3 </since_tizen>
1663 public bool Visibility
1668 var pValue = GetProperty(View.Property.VISIBLE);
1669 pValue.Get(out temp);
1676 /// Gets the view's world color.
1678 /// <since_tizen> 3 </since_tizen>
1679 public Vector4 WorldColor
1683 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1684 var pValue = GetProperty(View.Property.WorldColor);
1692 /// Gets or sets the view's name.
1694 /// <since_tizen> 3 </since_tizen>
1699 return (string)GetValue(NameProperty);
1703 SetValue(NameProperty, value);
1704 NotifyPropertyChanged();
1709 /// Get the number of children held by the view.
1711 /// <since_tizen> 3 </since_tizen>
1712 public new uint ChildCount
1716 return Convert.ToUInt32(Children.Count);
1721 /// Gets the view's ID.
1724 /// <since_tizen> 3 </since_tizen>
1734 /// Gets or sets the status of whether the view should emit touch or hover signals.
1735 /// If a View is made insensitive, then the View and its children are not hittable.
1737 /// <since_tizen> 3 </since_tizen>
1738 public bool Sensitive
1742 return (bool)GetValue(SensitiveProperty);
1746 SetValue(SensitiveProperty, value);
1747 NotifyPropertyChanged();
1752 /// 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.
1754 /// <since_tizen> 3 </since_tizen>
1755 public bool LeaveRequired
1759 return (bool)GetValue(LeaveRequiredProperty);
1763 SetValue(LeaveRequiredProperty, value);
1764 NotifyPropertyChanged();
1769 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1771 /// <since_tizen> 3 </since_tizen>
1772 public bool InheritOrientation
1776 return (bool)GetValue(InheritOrientationProperty);
1780 SetValue(InheritOrientationProperty, value);
1781 NotifyPropertyChanged();
1786 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1788 /// <since_tizen> 3 </since_tizen>
1789 public bool InheritScale
1793 return (bool)GetValue(InheritScaleProperty);
1797 SetValue(InheritScaleProperty, value);
1798 NotifyPropertyChanged();
1803 /// Gets or sets the status of how the view and its children should be drawn.<br />
1804 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1805 /// 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 />
1806 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1807 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1808 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1810 /// <since_tizen> 3 </since_tizen>
1811 public DrawModeType DrawMode
1815 return (DrawModeType)GetValue(DrawModeProperty);
1819 SetValue(DrawModeProperty, value);
1820 NotifyPropertyChanged();
1825 /// Gets or sets the relative to parent size factor of the view.<br />
1826 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1827 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1830 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1832 /// <since_tizen> 3 </since_tizen>
1833 public Vector3 SizeModeFactor
1837 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1838 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1842 SetValue(SizeModeFactorProperty, value);
1843 NotifyPropertyChanged();
1848 /// Gets or sets the width resize policy to be used.
1850 /// <since_tizen> 3 </since_tizen>
1851 public ResizePolicyType WidthResizePolicy
1855 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1859 // Store ResizePolicy to restore it when Layout is unset.
1860 widthResizePolicy = value;
1862 SetValue(WidthResizePolicyProperty, value);
1863 NotifyPropertyChanged();
1868 /// Gets or sets the height resize policy to be used.
1870 /// <since_tizen> 3 </since_tizen>
1871 public ResizePolicyType HeightResizePolicy
1875 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1879 // Store ResizePolicy to restore it when Layout is unset.
1880 heightResizePolicy = value;
1882 SetValue(HeightResizePolicyProperty, value);
1883 NotifyPropertyChanged();
1888 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1889 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1891 /// <since_tizen> 3 </since_tizen>
1892 public SizeScalePolicyType SizeScalePolicy
1896 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1900 SetValue(SizeScalePolicyProperty, value);
1901 NotifyPropertyChanged();
1906 /// Gets or sets the status of whether the width size is dependent on the height size.
1908 /// <since_tizen> 3 </since_tizen>
1909 public bool WidthForHeight
1913 return (bool)GetValue(WidthForHeightProperty);
1917 SetValue(WidthForHeightProperty, value);
1918 NotifyPropertyChanged();
1923 /// Gets or sets the status of whether the height size is dependent on the width size.
1925 /// <since_tizen> 3 </since_tizen>
1926 public bool HeightForWidth
1930 return (bool)GetValue(HeightForWidthProperty);
1934 SetValue(HeightForWidthProperty, value);
1935 NotifyPropertyChanged();
1940 /// Gets or sets the padding for use in layout.
1943 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1945 /// <since_tizen> 5 </since_tizen>
1946 public Extents Padding
1950 // If View has a Layout then padding in stored in the base Layout class
1953 return Layout.Padding;
1957 Extents temp = (Extents)GetValue(PaddingProperty);
1958 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1960 // Two return points to prevent creating a zeroed Extent native object before assignment
1964 Extents padding = value;
1967 // Layout set so store Padding in LayoutItem instead of in View.
1968 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1969 // the position and sizes measure in the Layouting.
1970 Layout.Padding = value;
1971 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1972 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1973 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1975 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1979 SetValue(PaddingProperty, padding);
1980 NotifyPropertyChanged();
1985 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1987 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1989 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1991 /// <since_tizen> 3 </since_tizen>
1992 public Size2D MinimumSize
1996 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1997 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
2003 throw new ArgumentNullException(nameof(value));
2007 // Note: it only works if minimum size is >= than natural size.
2008 // To force the size it should be done through the width&height spec or Size2D.
2009 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
2010 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
2011 layout.RequestLayout();
2013 SetValue(MinimumSizeProperty, value);
2014 NotifyPropertyChanged();
2019 /// Gets or sets the maximum size the view can be assigned in size negotiation.
2022 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
2024 /// <since_tizen> 3 </since_tizen>
2025 public Size2D MaximumSize
2029 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
2030 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
2034 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
2035 // MATCH_PARENT spec + parent container size can be used to limit
2038 layout.RequestLayout();
2040 SetValue(MaximumSizeProperty, value);
2041 NotifyPropertyChanged();
2046 /// Gets or sets whether a child view inherits it's parent's position.<br />
2047 /// Default is to inherit.<br />
2048 /// 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 />
2050 /// <since_tizen> 3 </since_tizen>
2051 public bool InheritPosition
2055 return (bool)GetValue(InheritPositionProperty);
2059 SetValue(InheritPositionProperty, value);
2060 NotifyPropertyChanged();
2065 /// Gets or sets the clipping behavior (mode) of it's children.
2067 /// <since_tizen> 3 </since_tizen>
2068 public ClippingModeType ClippingMode
2072 return (ClippingModeType)GetValue(ClippingModeProperty);
2076 SetValue(ClippingModeProperty, value);
2077 NotifyPropertyChanged();
2082 /// Gets the number of renderers held by the view.
2084 /// <since_tizen> 3 </since_tizen>
2085 public uint RendererCount
2089 return GetRendererCount();
2094 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2097 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2099 /// <since_tizen> 3 </since_tizen>
2100 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2102 "View view = new View(); " +
2103 "view.PivotPoint = PivotPoint.Center; " +
2104 "view.PositionUsesPivotPoint = true;")]
2105 [EditorBrowsable(EditorBrowsableState.Never)]
2106 public Position AnchorPoint
2110 return GetValue(AnchorPointProperty) as Position;
2114 SetValue(AnchorPointProperty, value);
2118 private Position InternalAnchorPoint
2122 Position temp = new Position(0.0f, 0.0f, 0.0f);
2123 var pValue = GetProperty(View.Property.AnchorPoint);
2126 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2132 var temp = new Tizen.NUI.PropertyValue(value);
2133 SetProperty(View.Property.AnchorPoint, temp);
2135 NotifyPropertyChanged();
2140 /// Sets the size of a view for the width, the height and the depth.<br />
2141 /// Geometry can be scaled to fit within this area.<br />
2142 /// This does not interfere with the view's scale factor.<br />
2143 /// The views default depth is the minimum of width and height.<br />
2147 /// Animatable - This property can be animated using <c>Animation</c> class.
2149 /// animation.AnimateTo(view, "Size", new Size(100, 100));
2152 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2154 /// <since_tizen> 5 </since_tizen>
2159 Size tmp = (Size)GetValue(SizeProperty);
2160 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2164 SetValue(SizeProperty, value);
2165 NotifyPropertyChanged();
2170 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2172 /// <since_tizen> 3 </since_tizen>
2173 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2175 "Container parent = view.GetParent(); " +
2176 "View view = parent as View;")]
2177 [EditorBrowsable(EditorBrowsableState.Never)]
2178 public new View Parent
2183 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2184 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2185 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2187 if (basehandle is Layer layer)
2189 ret = new View(Layer.getCPtr(layer).Handle, false);
2190 NUILog.Error("This Parent property is deprecated, should do not be used");
2194 ret = basehandle as View;
2197 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2198 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2200 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2206 /// Gets/Sets whether inherit parent's the layout Direction.
2208 /// <since_tizen> 4 </since_tizen>
2209 public bool InheritLayoutDirection
2213 return (bool)GetValue(InheritLayoutDirectionProperty);
2217 SetValue(InheritLayoutDirectionProperty, value);
2218 NotifyPropertyChanged();
2223 /// Gets/Sets the layout Direction.
2225 /// <since_tizen> 4 </since_tizen>
2226 public ViewLayoutDirectionType LayoutDirection
2230 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2234 SetValue(LayoutDirectionProperty, value);
2235 NotifyPropertyChanged();
2236 layout?.RequestLayout();
2241 /// Gets or sets the Margin for use in layout.
2244 /// Margin property is supported by Layout algorithms and containers.
2245 /// Please Set Layout if you want to use Margin property.
2246 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2248 /// <since_tizen> 4 </since_tizen>
2249 public Extents Margin
2253 // If View has a Layout then margin is stored in Layout.
2256 return Layout.Margin;
2260 // If Layout not set then return margin stored in View.
2261 Extents temp = (Extents)GetValue(MarginProperty);
2262 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2264 // Two return points to prevent creating a zeroed Extent native object before assignment
2270 // Layout set so store Margin in LayoutItem instead of View.
2271 // If View stores the Margin too then the Legacy Size Negotiation will
2272 // overwrite the position and size values measured in the Layouting.
2273 Layout.Margin = value;
2274 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2275 layout?.RequestLayout();
2279 SetValue(MarginProperty, value);
2281 NotifyPropertyChanged();
2282 layout?.RequestLayout();
2287 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2291 /// // matchParentView matches its size to its parent size.
2292 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2293 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2295 /// // wrapContentView wraps its children with their desired size.
2296 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2297 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2299 /// // exactSizeView shows itself with an exact size.
2300 /// exactSizeView.WidthSpecification = 100;
2301 /// exactSizeView.HeightSpecification = 100;
2304 /// <since_tizen> 6 </since_tizen>
2305 [Binding.TypeConverter(typeof(IntDpTypeConverter))]
2306 public int WidthSpecification
2310 return (int)GetValue(WidthSpecificationProperty);
2314 SetValue(WidthSpecificationProperty, value);
2315 NotifyPropertyChanged();
2319 private int InternalWidthSpecification
2327 if (value == widthPolicy)
2330 widthPolicy = value;
2331 if (widthPolicy >= 0)
2333 if (heightPolicy >= 0) // Policy an exact value
2335 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2336 Size2D = new Size2D(widthPolicy, heightPolicy);
2339 layout?.RequestLayout();
2344 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2348 /// // matchParentView matches its size to its parent size.
2349 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2350 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2352 /// // wrapContentView wraps its children with their desired size.
2353 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2354 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2356 /// // exactSizeView shows itself with an exact size.
2357 /// exactSizeView.WidthSpecification = 100;
2358 /// exactSizeView.HeightSpecification = 100;
2361 /// <since_tizen> 6 </since_tizen>
2362 [Binding.TypeConverter(typeof(IntDpTypeConverter))]
2363 public int HeightSpecification
2367 return (int)GetValue(HeightSpecificationProperty);
2371 SetValue(HeightSpecificationProperty, value);
2372 NotifyPropertyChanged();
2376 private int InternalHeightSpecification
2380 return heightPolicy;
2384 if (value == heightPolicy)
2387 heightPolicy = value;
2388 if (heightPolicy >= 0)
2390 if (widthPolicy >= 0) // Policy an exact value
2392 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2393 Size2D = new Size2D(widthPolicy, heightPolicy);
2396 layout?.RequestLayout();
2401 /// Gets the List of transitions for this View.
2403 /// <since_tizen> 6 </since_tizen>
2404 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2408 if (layoutTransitions == null)
2410 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2412 return layoutTransitions;
2417 /// Sets a layout transitions for this View.
2419 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2421 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2423 /// <since_tizen> 6 </since_tizen>
2424 public LayoutTransition LayoutTransition
2428 return GetValue(LayoutTransitionProperty) as LayoutTransition;
2432 SetValue(LayoutTransitionProperty, value);
2433 NotifyPropertyChanged();
2437 private LayoutTransition InternalLayoutTransition
2441 return layoutTransition;
2447 throw new global::System.ArgumentNullException(nameof(value));
2449 if (layoutTransitions == null)
2451 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2454 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2456 AttachTransitionsToChildren(value);
2458 layoutTransition = value;
2463 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2466 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2468 /// <since_tizen> 4 </since_tizen>
2469 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2470 [EditorBrowsable(EditorBrowsableState.Never)]
2471 public Extents PaddingEX
2475 return GetValue(PaddingEXProperty) as Extents;
2479 SetValue(PaddingEXProperty, value);
2483 private Extents InternalPaddingEX
2487 Extents temp = new Extents(0, 0, 0, 0);
2488 var pValue = GetProperty(View.Property.PADDING);
2491 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2497 var temp = new Tizen.NUI.PropertyValue(value);
2498 SetProperty(View.Property.PADDING, temp);
2500 NotifyPropertyChanged();
2501 layout?.RequestLayout();
2505 [EditorBrowsable(EditorBrowsableState.Never)]
2506 public XamlStyle XamlStyle
2510 return (XamlStyle)GetValue(XamlStyleProperty);
2514 SetValue(XamlStyleProperty, value);
2519 /// The Color of View. This is an RGBA value.
2523 /// Animatable - This property can be animated using <c>Animation</c> class.
2525 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2527 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2528 [EditorBrowsable(EditorBrowsableState.Never)]
2533 Color temp = (Color)GetValue(ColorProperty);
2534 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2538 SetValue(ColorProperty, value);
2539 NotifyPropertyChanged();
2544 /// Set the layout on this View. Replaces any existing Layout.
2547 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2549 /// <since_tizen> 6 </since_tizen>
2550 public LayoutItem Layout
2554 return GetValue(LayoutProperty) as LayoutItem;
2558 // ResizePolicy is restored when Layout is unset and it is considered when View size is calculated.
2559 // SetValue(LayoutProperty, value) sets InternalLayout only if layout is not null.
2562 RestoreResizePolicy();
2565 SetValue(LayoutProperty, value);
2569 private LayoutItem InternalLayout
2577 // Do nothing if layout provided is already set on this View.
2578 if (value == layout)
2583 LayoutingDisabled = false;
2586 // If new layout being set already has a owner then that owner receives a replacement default layout.
2587 // First check if the layout to be set already has a owner.
2588 if (value?.Owner != null)
2590 // Previous owner of the layout gets a default layout as a replacement.
2591 value.Owner.Layout = new AbsoluteLayout()
2593 // Copy Margin and Padding to replacement LayoutGroup.
2594 Margin = value.Margin,
2595 Padding = value.Padding,
2599 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2600 // View if no replacement. Previously margin and padding values would have been moved from
2601 // the View to the layout.
2602 if (layout != null) // Existing layout
2606 // Existing layout being replaced so copy over margin and padding values.
2607 value.Margin = layout.Margin;
2608 value.Padding = layout.Padding;
2609 value.SetPositionByLayout = !excludeLayouting;
2613 // Layout not being replaced so restore margin and padding to View.
2614 SetValue(MarginProperty, layout.Margin);
2615 SetValue(PaddingProperty, layout.Padding);
2616 NotifyPropertyChanged();
2621 // First Layout to be added to the View hence copy
2623 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2626 Extents margin = Margin;
2627 Extents padding = Padding;
2628 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2630 // If View already has a margin set then store it in Layout instead.
2631 value.Margin = margin;
2632 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2633 NotifyPropertyChanged();
2636 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2638 // If View already has a padding set then store it in Layout instead.
2639 value.Padding = padding;
2641 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2642 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2643 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2645 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2646 NotifyPropertyChanged();
2650 value.SetPositionByLayout = !excludeLayouting;
2654 // Remove existing layout from it's parent layout group.
2657 // Set layout to this view
2663 /// The weight of the View, used to share available space in a layout with siblings.
2665 /// <since_tizen> 6 </since_tizen>
2675 layout?.RequestLayout();
2680 /// Whether to load the BackgroundImage synchronously.
2681 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2682 /// Note: For Normal Quad images only.
2684 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2685 [EditorBrowsable(EditorBrowsableState.Never)]
2686 public bool BackgroundImageSynchronosLoading
2690 return (bool)GetValue(BackgroundImageSynchronosLoadingProperty);
2694 SetValue(BackgroundImageSynchronosLoadingProperty, value);
2695 NotifyPropertyChanged();
2699 private bool InternalBackgroundImageSynchronosLoading
2703 return BackgroundImageSynchronousLoading;
2707 BackgroundImageSynchronousLoading = value;
2712 /// Whether to load the BackgroundImage synchronously.
2713 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2714 /// Note: For Normal Quad images only.
2716 /// This will be public opened in tizen_7.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2717 [EditorBrowsable(EditorBrowsableState.Never)]
2718 public bool BackgroundImageSynchronousLoading
2722 return (bool)GetValue(BackgroundImageSynchronousLoadingProperty);
2726 SetValue(BackgroundImageSynchronousLoadingProperty, value);
2727 NotifyPropertyChanged();
2731 private bool InternalBackgroundImageSynchronousLoading
2735 return backgroundImageSynchronousLoading;
2739 backgroundImageSynchronousLoading = value;
2741 string bgUrl = null;
2742 var pValue = Background.Find(ImageVisualProperty.URL);
2743 pValue?.Get(out bgUrl);
2746 if (!string.IsNullOrEmpty(bgUrl))
2748 PropertyMap bgMap = this.Background;
2749 var temp = new PropertyValue(backgroundImageSynchronousLoading);
2750 bgMap.Add("synchronousLoading", temp);
2757 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2758 [EditorBrowsable(EditorBrowsableState.Never)]
2759 public Vector2 UpdateSizeHint
2763 return (Vector2)GetValue(UpdateSizeHintProperty);
2767 SetValue(UpdateSizeHintProperty, value);
2768 NotifyPropertyChanged();
2773 /// Enable/Disable ControlState propagation for children.
2774 /// It is false by default.
2775 /// If the View needs to share ControlState with descendants, please set it true.
2776 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2778 [EditorBrowsable(EditorBrowsableState.Never)]
2779 public bool EnableControlStatePropagation
2783 return (bool)GetValue(EnableControlStatePropagationProperty);
2787 SetValue(EnableControlStatePropagationProperty, value);
2788 NotifyPropertyChanged();
2792 private bool InternalEnableControlStatePropagation
2794 get => themeData?.ControlStatePropagation ?? false;
2797 if (InternalEnableControlStatePropagation == value) return;
2799 if (themeData == null) themeData = new ThemeData();
2801 themeData.ControlStatePropagation = value;
2803 foreach (View child in Children)
2805 child.EnableControlStatePropagation = value;
2811 /// By default, it is false in View, true in Control.
2812 /// Note that if the value is true, the View will be a touch receptor.
2814 [EditorBrowsable(EditorBrowsableState.Never)]
2815 public bool EnableControlState
2819 return (bool)GetValue(EnableControlStateProperty);
2823 SetValue(EnableControlStateProperty, value);
2828 /// Whether the actor grab all touches even if touch leaves its boundary.
2830 /// <returns>true, if it grab all touch after start</returns>
2831 [EditorBrowsable(EditorBrowsableState.Never)]
2832 public bool GrabTouchAfterLeave
2836 return (bool)GetValue(GrabTouchAfterLeaveProperty);
2840 SetValue(GrabTouchAfterLeaveProperty, value);
2844 private bool InternalGrabTouchAfterLeave
2849 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2850 pValue.Get(out temp);
2856 var temp = new Tizen.NUI.PropertyValue(value);
2857 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2859 NotifyPropertyChanged();
2864 /// Determines which blend equation will be used to render renderers of this actor.
2866 /// <returns>blend equation enum currently assigned</returns>
2867 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2868 [EditorBrowsable(EditorBrowsableState.Never)]
2869 public BlendEquationType BlendEquation
2873 return (BlendEquationType)GetValue(BlendEquationProperty);
2877 SetValue(BlendEquationProperty, value);
2881 private BlendEquationType InternalBlendEquation
2886 var pValue = GetProperty(View.Property.BlendEquation);
2887 pValue.Get(out temp);
2889 return (BlendEquationType)temp;
2893 var temp = new Tizen.NUI.PropertyValue((int)value);
2894 SetProperty(View.Property.BlendEquation, temp);
2896 NotifyPropertyChanged();
2901 /// If the value is true, the View will change its style as the theme changes.
2902 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
2904 /// <since_tizen> 9 </since_tizen>
2905 public bool ThemeChangeSensitive
2907 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2908 set => SetValue(ThemeChangeSensitiveProperty, value);
2912 /// Create Style, it is abstract function and must be override.
2914 [EditorBrowsable(EditorBrowsableState.Never)]
2915 protected virtual ViewStyle CreateViewStyle()
2917 return new ViewStyle();
2921 /// Called after the View's ControlStates changed.
2923 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2924 [EditorBrowsable(EditorBrowsableState.Never)]
2925 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2931 [EditorBrowsable(EditorBrowsableState.Never)]
2932 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2934 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
2935 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
2939 /// Apply style instance to the view.
2940 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2942 /// <since_tizen> 9 </since_tizen>
2943 public virtual void ApplyStyle(ViewStyle viewStyle)
2945 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
2947 if (themeData == null) themeData = new ThemeData();
2949 themeData.viewStyle = viewStyle;
2951 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2957 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2959 if (bindablePropertyOfView == null)
2964 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2965 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2967 foreach (var sourceProperty in dirtyStyleProperties)
2969 var sourceValue = viewStyle.GetValue(sourceProperty);
2971 if (sourceValue == null)
2976 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2978 if (destinationProperty != null)
2980 SetValue(destinationProperty, sourceValue);
2986 /// Get whether the View is culled or not.
2987 /// True means that the View is out of the view frustum.
2990 /// Hidden-API (Inhouse-API).
2992 [EditorBrowsable(EditorBrowsableState.Never)]
2998 var pValue = GetProperty(View.Property.Culled);
2999 pValue.Get(out temp);
3006 /// Set or Get TransitionOptions for the page transition.
3007 /// This property is used to define how this view will be transitioned during Page switching.
3009 /// <since_tizen> 9 </since_tizen>
3010 public TransitionOptions TransitionOptions
3014 return GetValue(TransitionOptionsProperty) as TransitionOptions;
3018 SetValue(TransitionOptionsProperty, value);
3019 NotifyPropertyChanged();
3023 private TransitionOptions InternalTransitionOptions
3027 transitionOptions = value;
3031 return transitionOptions;
3036 /// Gets or sets the status of whether the view should emit key event signals.
3037 /// If a View's DispatchKeyEvents is set to false, then it's children will not emit a key event signal either.
3039 [EditorBrowsable(EditorBrowsableState.Never)]
3040 public bool DispatchKeyEvents
3044 return (bool)GetValue(DispatchKeyEventsProperty);
3048 SetValue(DispatchKeyEventsProperty, value);
3049 NotifyPropertyChanged();