2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
33 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
35 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public bool layoutSet = false;
40 /// Flag to allow Layouting to be disabled for Views.
41 /// Once a View has a Layout set then any children added to Views from then on will receive
42 /// automatic Layouts.
44 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public static bool layoutingDisabled{get; set;} = true;
48 private LayoutItem _layout; // Exclusive layout assigned to this View.
50 // List of transitions paired with the condition that uses the transition.
51 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54 private int _oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later
55 private int _oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later
56 private float _weight = 0.0f; // Weighting of child View in a Layout
57 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
58 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
59 private bool _backgroundImageSynchronosLoading = false;
60 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
61 private string[] transitionNames;
62 private bool controlStatePropagation = false;
64 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
65 internal BackgroundExtraData backgroundExtraData;
70 /// The Style instance binded with this View.
72 private ViewStyle viewStyle;
74 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
75 [EditorBrowsable(EditorBrowsableState.Never)]
76 public ViewStyle ViewStyle
80 if (null == viewStyle)
82 ApplyStyle(GetViewStyle());
90 /// Creates a new instance of a view.
92 /// <since_tizen> 3 </since_tizen>
93 public View() : this(Interop.View.View_New(), true)
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
99 [EditorBrowsable(EditorBrowsableState.Never)]
100 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
102 this.ViewStyle.CopyFrom(viewStyle);
106 /// Create a new instance of a View with setting the status of shown or hidden.
108 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
109 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
110 [EditorBrowsable(EditorBrowsableState.Never)]
111 public View(bool shown) : this(Interop.View.View_New(), true)
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
128 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
130 if (this.viewStyle == null)
132 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
136 this.viewStyle.CopyFrom(viewStyle);
140 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
144 PositionUsesPivotPoint = false;
147 _onWindowSendEventCallback = SendViewAddedEventToWindow;
148 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
156 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
158 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 /// The event that is triggered when the View's ControlState is changed.
169 [EditorBrowsable(EditorBrowsableState.Never)]
170 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
172 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
174 private ControlStates controlStates;
176 /// Get/Set the control state.
178 /// <since_tizen> 6 </since_tizen>
179 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
180 [EditorBrowsable(EditorBrowsableState.Never)]
181 public ControlStates ControlState
185 return controlStates;
189 if (controlStates == value)
194 var prevState = controlStates;
196 controlStates = value;
198 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
200 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
202 OnControlStateChanged(changeInfo);
204 if (controlStatePropagation)
206 foreach (View child in Children)
208 child.ControlState = value;
212 ControlStateChangedEvent?.Invoke(this, changeInfo);
216 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
217 [EditorBrowsable(EditorBrowsableState.Never)]
218 public bool IsResourcesCreated
222 return Application.Current.IsResourcesCreated;
226 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
227 [EditorBrowsable(EditorBrowsableState.Never)]
228 public ResourceDictionary XamlResources
232 return Application.Current.XamlResources;
236 Application.Current.XamlResources = value;
241 /// The StyleName, type string.
243 /// <since_tizen> 3 </since_tizen>
244 public string StyleName
248 return (string)GetValue(StyleNameProperty);
252 SetValue(StyleNameProperty, value);
253 NotifyPropertyChanged();
258 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
261 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
263 /// <since_tizen> 3 </since_tizen>
264 public Color BackgroundColor
268 Color temp = (Color)GetValue(BackgroundColorProperty);
269 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
273 if (viewStyle != null)
275 viewStyle.BackgroundImage = null;
276 viewStyle.BackgroundColor = value;
280 SetValue(BackgroundColorProperty, value);
283 NotifyPropertyChanged();
288 /// The mutually exclusive with "backgroundColor" and "background" type Map.
290 /// <since_tizen> 3 </since_tizen>
291 public string BackgroundImage
295 return (string)GetValue(BackgroundImageProperty);
299 if (viewStyle != null)
301 viewStyle.BackgroundColor = null;
302 viewStyle.BackgroundImage = value;
306 SetValue(BackgroundImageProperty, value);
309 NotifyPropertyChanged();
314 /// Get or set the border of background image.
316 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
317 [EditorBrowsable(EditorBrowsableState.Never)]
318 public Rectangle BackgroundImageBorder
322 return (Rectangle)GetValue(BackgroundImageBorderProperty);
326 if (viewStyle != null)
328 viewStyle.BackgroundImageBorder = value;
332 SetValue(BackgroundImageBorderProperty, value);
335 NotifyPropertyChanged();
340 /// The background of view.
342 /// <since_tizen> 3 </since_tizen>
343 public Tizen.NUI.PropertyMap Background
347 return (PropertyMap)GetValue(BackgroundProperty);
351 SetValue(BackgroundProperty, value);
352 NotifyPropertyChanged();
357 /// Describes a shadow as an image for a View.
358 /// It is null by default.
361 /// Gettter returns copied instance of current shadow.
364 /// The mutually exclusive with "BoxShadow".
366 [EditorBrowsable(EditorBrowsableState.Never)]
367 public ImageShadow ImageShadow
371 return (ImageShadow)GetValue(ImageShadowProperty);
375 SetValue(ImageShadowProperty, value);
376 NotifyPropertyChanged();
381 /// Describes a box shaped shadow drawing for a View.
382 /// It is null by default.
385 /// Gettter returns copied instance of current shadow.
388 /// The mutually exclusive with "ImageShadow".
390 [EditorBrowsable(EditorBrowsableState.Never)]
391 public Shadow BoxShadow
395 return (Shadow)GetValue(BoxShadowProperty);
399 SetValue(BoxShadowProperty, value);
400 NotifyPropertyChanged();
405 /// The radius for the rounded corners of the View.
406 /// This will rounds background and shadow edges.
407 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
409 [EditorBrowsable(EditorBrowsableState.Never)]
410 public float CornerRadius
414 return (float)GetValue(CornerRadiusProperty);
418 SetValue(CornerRadiusProperty, value);
419 NotifyPropertyChanged();
424 /// The current state of the view.
426 /// <since_tizen> 3 </since_tizen>
431 return (States)GetValue(StateProperty);
435 SetValue(StateProperty, value);
436 NotifyPropertyChanged();
441 /// The current sub state of the view.
443 /// <since_tizen> 3 </since_tizen>
444 public States SubState
448 return (States)GetValue(SubStateProperty);
452 SetValue(SubStateProperty, value);
453 NotifyPropertyChanged();
458 /// Displays a tooltip
460 /// <since_tizen> 3 </since_tizen>
461 public Tizen.NUI.PropertyMap Tooltip
465 return (PropertyMap)GetValue(TooltipProperty);
469 SetValue(TooltipProperty, value);
470 NotifyPropertyChanged();
475 /// Displays a tooltip as a text.
477 /// <since_tizen> 3 </since_tizen>
478 public string TooltipText
482 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
483 NotifyPropertyChanged();
488 /// The Child property of FlexContainer.<br />
489 /// The proportion of the free space in the container, the flex item will receive.<br />
490 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
492 /// <since_tizen> 3 </since_tizen>
497 return (float)GetValue(FlexProperty);
501 SetValue(FlexProperty, value);
502 NotifyPropertyChanged();
507 /// The Child property of FlexContainer.<br />
508 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
510 /// <since_tizen> 3 </since_tizen>
515 return (int)GetValue(AlignSelfProperty);
519 SetValue(AlignSelfProperty, value);
520 NotifyPropertyChanged();
525 /// The Child property of FlexContainer.<br />
526 /// The space around the flex item.<br />
529 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
531 /// <since_tizen> 3 </since_tizen>
532 public Vector4 FlexMargin
536 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
537 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
541 SetValue(FlexMarginProperty, value);
542 NotifyPropertyChanged();
547 /// The top-left cell this child occupies, if not set, the first available cell is used.
550 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
552 /// <since_tizen> 3 </since_tizen>
553 public Vector2 CellIndex
557 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
558 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
562 SetValue(CellIndexProperty, value);
563 NotifyPropertyChanged();
568 /// The number of rows this child occupies, if not set, the default value is 1.
570 /// <since_tizen> 3 </since_tizen>
575 return (float)GetValue(RowSpanProperty);
579 SetValue(RowSpanProperty, value);
580 NotifyPropertyChanged();
585 /// The number of columns this child occupies, if not set, the default value is 1.
587 /// <since_tizen> 3 </since_tizen>
588 public float ColumnSpan
592 return (float)GetValue(ColumnSpanProperty);
596 SetValue(ColumnSpanProperty, value);
597 NotifyPropertyChanged();
602 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
604 /// <since_tizen> 3 </since_tizen>
605 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
609 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
613 SetValue(CellHorizontalAlignmentProperty, value);
614 NotifyPropertyChanged();
619 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
621 /// <since_tizen> 3 </since_tizen>
622 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
626 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
630 SetValue(CellVerticalAlignmentProperty, value);
631 NotifyPropertyChanged();
636 /// The left focusable view.<br />
637 /// This will return null if not set.<br />
638 /// This will also return null if the specified left focusable view is not on a window.<br />
640 /// <since_tizen> 3 </since_tizen>
641 public View LeftFocusableView
643 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
646 return (View)GetValue(LeftFocusableViewProperty);
650 SetValue(LeftFocusableViewProperty, value);
651 NotifyPropertyChanged();
656 /// The right focusable view.<br />
657 /// This will return null if not set.<br />
658 /// This will also return null if the specified right focusable view is not on a window.<br />
660 /// <since_tizen> 3 </since_tizen>
661 public View RightFocusableView
663 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
666 return (View)GetValue(RightFocusableViewProperty);
670 SetValue(RightFocusableViewProperty, value);
671 NotifyPropertyChanged();
676 /// The up focusable view.<br />
677 /// This will return null if not set.<br />
678 /// This will also return null if the specified up focusable view is not on a window.<br />
680 /// <since_tizen> 3 </since_tizen>
681 public View UpFocusableView
683 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
686 return (View)GetValue(UpFocusableViewProperty);
690 SetValue(UpFocusableViewProperty, value);
691 NotifyPropertyChanged();
696 /// The down focusable view.<br />
697 /// This will return null if not set.<br />
698 /// This will also return null if the specified down focusable view is not on a window.<br />
700 /// <since_tizen> 3 </since_tizen>
701 public View DownFocusableView
703 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
706 return (View)GetValue(DownFocusableViewProperty);
710 SetValue(DownFocusableViewProperty, value);
711 NotifyPropertyChanged();
716 /// Whether the view should be focusable by keyboard navigation.
718 /// <since_tizen> 3 </since_tizen>
719 public bool Focusable
723 SetValue(FocusableProperty, value);
724 NotifyPropertyChanged();
728 return (bool)GetValue(FocusableProperty);
733 /// Retrieves the position of the view.<br />
734 /// The coordinates are relative to the view's parent.<br />
736 /// <since_tizen> 3 </since_tizen>
737 public Position CurrentPosition
741 return GetCurrentPosition();
746 /// Sets the size of a view for the width and the height.<br />
747 /// Geometry can be scaled to fit within this area.<br />
748 /// This does not interfere with the view's scale factor.<br />
749 /// The views default depth is the minimum of width and height.<br />
752 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
753 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
755 /// <since_tizen> 3 </since_tizen>
760 Size2D temp = (Size2D)GetValue(Size2DProperty);
761 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
765 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
766 SetValue(Size2DProperty, value);
767 // Set Specification so when layouts measure this View it matches the value set here.
768 // All Views are currently Layouts.
769 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
770 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
771 _widthPolicy = value.Width;
772 _heightPolicy = value.Height;
773 _layout?.RequestLayout();
774 NotifyPropertyChanged();
779 /// Retrieves the size of the view.<br />
780 /// The coordinates are relative to the view's parent.<br />
782 /// <since_tizen> 3 </since_tizen>
783 public Size2D CurrentSize
787 return GetCurrentSize();
792 /// Retrieves and sets the view's opacity.<br />
794 /// <since_tizen> 3 </since_tizen>
799 return (float)GetValue(OpacityProperty);
803 if (viewStyle != null)
805 viewStyle.Opacity = value;
809 SetValue(OpacityProperty, value);
812 NotifyPropertyChanged();
817 /// Sets the position of the view for X and Y.<br />
818 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
819 /// If the position inheritance is disabled, sets the world position.<br />
822 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
823 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
825 /// <since_tizen> 3 </since_tizen>
826 public Position2D Position2D
830 Position2D temp = (Position2D)GetValue(Position2DProperty);
831 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
835 SetValue(Position2DProperty, value);
836 NotifyPropertyChanged();
841 /// Retrieves the screen postion of the view.<br />
843 /// <since_tizen> 3 </since_tizen>
844 public Vector2 ScreenPosition
848 Vector2 temp = new Vector2(0.0f, 0.0f);
849 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
855 /// Determines whether the pivot point should be used to determine the position of the view.
856 /// This is true by default.
858 /// <remarks>If false, then the top-left of the view is used for the position.
859 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
861 /// <since_tizen> 3 </since_tizen>
862 public bool PositionUsesPivotPoint
866 return (bool)GetValue(PositionUsesPivotPointProperty);
870 SetValue(PositionUsesPivotPointProperty, value);
871 NotifyPropertyChanged();
876 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
878 /// <since_tizen> 3 </since_tizen>
879 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
881 "View view = new View(); " +
882 "view.PivotPoint = PivotPoint.Center; " +
883 "view.PositionUsesPivotPoint = true;" +
884 " Deprecated in API5: Will be removed in API8")]
885 [EditorBrowsable(EditorBrowsableState.Never)]
886 public bool PositionUsesAnchorPoint
891 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
896 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
897 NotifyPropertyChanged();
902 /// Queries whether the view is connected to the stage.<br />
903 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
905 /// <since_tizen> 3 </since_tizen>
906 public bool IsOnWindow
915 /// Gets the depth in the hierarchy for the view.
917 /// <since_tizen> 3 </since_tizen>
918 public int HierarchyDepth
922 return GetHierarchyDepth();
927 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
930 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
931 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
932 /// The values set by this property will likely change.
934 /// <since_tizen> 3 </since_tizen>
935 public int SiblingOrder
939 return (int)GetValue(SiblingOrderProperty);
943 SetValue(SiblingOrderProperty, value);
945 LayoutGroup layout = Layout as LayoutGroup;
946 layout?.ChangeLayoutSiblingOrder(value);
948 NotifyPropertyChanged();
953 /// Returns the natural size of the view.
956 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
958 /// <since_tizen> 5 </since_tizen>
959 public Vector3 NaturalSize
963 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
964 if (NDalicPINVOKE.SWIGPendingException.Pending)
965 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
971 /// Returns the natural size (Size2D) of the view.
974 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
976 /// <since_tizen> 4 </since_tizen>
977 public Size2D NaturalSize2D
981 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
982 if (NDalicPINVOKE.SWIGPendingException.Pending)
983 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
985 return new Size2D((int)temp.Width, (int)temp.Height);
990 /// Gets or sets the origin of a view within its parent's area.<br />
991 /// 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 />
992 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
993 /// A view's position is the distance between this origin and the view's anchor-point.<br />
995 /// <pre>The view has been initialized.</pre>
996 /// <since_tizen> 3 </since_tizen>
997 public Position ParentOrigin
1001 Position tmp = (Position)GetValue(ParentOriginProperty);
1002 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1006 SetValue(ParentOriginProperty, value);
1007 NotifyPropertyChanged();
1012 /// Gets or sets the anchor-point of a view.<br />
1013 /// 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 />
1014 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1015 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1016 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1017 /// <pre>The view has been initialized.</pre>
1020 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1022 /// <since_tizen> 3 </since_tizen>
1023 public Position PivotPoint
1027 Position tmp = (Position)GetValue(PivotPointProperty);
1028 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1032 SetValue(PivotPointProperty, value);
1033 NotifyPropertyChanged();
1038 /// Gets or sets the size width of the view.
1042 /// Animatable - This property can be animated using <c>Animation</c> class.
1045 /// <since_tizen> 3 </since_tizen>
1046 public float SizeWidth
1050 return (float)GetValue(SizeWidthProperty);
1054 SetValue(SizeWidthProperty, value);
1055 NotifyPropertyChanged();
1060 /// Gets or sets the size height of the view.
1064 /// Animatable - This property can be animated using <c>Animation</c> class.
1067 /// <since_tizen> 3 </since_tizen>
1068 public float SizeHeight
1072 return (float)GetValue(SizeHeightProperty);
1076 SetValue(SizeHeightProperty, value);
1077 NotifyPropertyChanged();
1082 /// Gets or sets the position of the view.<br />
1083 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1084 /// If the position inheritance is disabled, sets the world position.<br />
1088 /// Animatable - This property can be animated using <c>Animation</c> class.
1090 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1092 /// <since_tizen> 3 </since_tizen>
1093 public Position Position
1097 Position tmp = (Position)GetValue(PositionProperty);
1098 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1102 SetValue(PositionProperty, value);
1103 NotifyPropertyChanged();
1108 /// Gets or sets the position X of the view.
1112 /// Animatable - This property can be animated using <c>Animation</c> class.
1115 /// <since_tizen> 3 </since_tizen>
1116 public float PositionX
1120 return (float)GetValue(PositionXProperty);
1124 SetValue(PositionXProperty, value);
1125 NotifyPropertyChanged();
1130 /// Gets or sets the position Y of the view.
1134 /// Animatable - This property can be animated using <c>Animation</c> class.
1137 /// <since_tizen> 3 </since_tizen>
1138 public float PositionY
1142 return (float)GetValue(PositionYProperty);
1146 SetValue(PositionYProperty, value);
1147 NotifyPropertyChanged();
1152 /// Gets or sets the position Z of the view.
1156 /// Animatable - This property can be animated using <c>Animation</c> class.
1159 /// <since_tizen> 3 </since_tizen>
1160 public float PositionZ
1164 return (float)GetValue(PositionZProperty);
1168 SetValue(PositionZProperty, value);
1169 NotifyPropertyChanged();
1174 /// Gets or sets the world position of the view.
1176 /// <since_tizen> 3 </since_tizen>
1177 public Vector3 WorldPosition
1181 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1182 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1188 /// Gets or sets the orientation of the view.<br />
1189 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1193 /// This is an asynchronous method.
1196 /// Animatable - This property can be animated using <c>Animation</c> class.
1199 /// <since_tizen> 3 </since_tizen>
1200 public Rotation Orientation
1204 return (Rotation)GetValue(OrientationProperty);
1208 SetValue(OrientationProperty, value);
1209 NotifyPropertyChanged();
1214 /// Gets or sets the world orientation of the view.<br />
1216 /// <since_tizen> 3 </since_tizen>
1217 public Rotation WorldOrientation
1221 Rotation temp = new Rotation();
1222 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1228 /// Gets or sets the scale factor applied to the view.<br />
1232 /// Animatable - This property can be animated using <c>Animation</c> class.
1234 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1236 /// <since_tizen> 3 </since_tizen>
1237 public Vector3 Scale
1241 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1242 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1246 SetValue(ScaleProperty, value);
1247 NotifyPropertyChanged();
1252 /// Gets or sets the scale X factor applied to the view.
1256 /// Animatable - This property can be animated using <c>Animation</c> class.
1259 /// <since_tizen> 3 </since_tizen>
1264 return (float)GetValue(ScaleXProperty);
1268 SetValue(ScaleXProperty, value);
1269 NotifyPropertyChanged();
1274 /// Gets or sets the scale Y factor applied to the view.
1278 /// Animatable - This property can be animated using <c>Animation</c> class.
1281 /// <since_tizen> 3 </since_tizen>
1286 return (float)GetValue(ScaleYProperty);
1290 SetValue(ScaleYProperty, value);
1291 NotifyPropertyChanged();
1296 /// Gets or sets the scale Z factor applied to the view.
1300 /// Animatable - This property can be animated using <c>Animation</c> class.
1303 /// <since_tizen> 3 </since_tizen>
1308 return (float)GetValue(ScaleZProperty);
1312 SetValue(ScaleZProperty, value);
1313 NotifyPropertyChanged();
1318 /// Gets the world scale of the view.
1320 /// <since_tizen> 3 </since_tizen>
1321 public Vector3 WorldScale
1325 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1326 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1332 /// Retrieves the visibility flag of the view.
1336 /// If the view is not visible, then the view and its children will not be rendered.
1337 /// 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.
1340 /// Animatable - This property can be animated using <c>Animation</c> class.
1343 /// <since_tizen> 3 </since_tizen>
1344 public bool Visibility
1349 GetProperty(View.Property.VISIBLE).Get(out temp);
1355 /// Gets the view's world color.
1357 /// <since_tizen> 3 </since_tizen>
1358 public Vector4 WorldColor
1362 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1363 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1369 /// Gets or sets the view's name.
1371 /// <since_tizen> 3 </since_tizen>
1376 return (string)GetValue(NameProperty);
1380 SetValue(NameProperty, value);
1381 NotifyPropertyChanged();
1386 /// Get the number of children held by the view.
1388 /// <since_tizen> 3 </since_tizen>
1389 public new uint ChildCount
1393 return GetChildCount();
1398 /// Gets the view's ID.
1401 /// <since_tizen> 3 </since_tizen>
1411 /// Gets or sets the status of whether the view should emit touch or hover signals.
1413 /// <since_tizen> 3 </since_tizen>
1414 public bool Sensitive
1418 return (bool)GetValue(SensitiveProperty);
1422 SetValue(SensitiveProperty, value);
1423 NotifyPropertyChanged();
1428 /// 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.
1430 /// <since_tizen> 3 </since_tizen>
1431 public bool LeaveRequired
1435 return (bool)GetValue(LeaveRequiredProperty);
1439 SetValue(LeaveRequiredProperty, value);
1440 NotifyPropertyChanged();
1445 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1447 /// <since_tizen> 3 </since_tizen>
1448 public bool InheritOrientation
1452 return (bool)GetValue(InheritOrientationProperty);
1456 SetValue(InheritOrientationProperty, value);
1457 NotifyPropertyChanged();
1462 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1464 /// <since_tizen> 3 </since_tizen>
1465 public bool InheritScale
1469 return (bool)GetValue(InheritScaleProperty);
1473 SetValue(InheritScaleProperty, value);
1474 NotifyPropertyChanged();
1479 /// Gets or sets the status of how the view and its children should be drawn.<br />
1480 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1481 /// 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 />
1482 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1483 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1484 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1486 /// <since_tizen> 3 </since_tizen>
1487 public DrawModeType DrawMode
1491 return (DrawModeType)GetValue(DrawModeProperty);
1495 SetValue(DrawModeProperty, value);
1496 NotifyPropertyChanged();
1501 /// Gets or sets the relative to parent size factor of the view.<br />
1502 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1503 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1506 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1508 /// <since_tizen> 3 </since_tizen>
1509 public Vector3 SizeModeFactor
1513 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1514 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1518 SetValue(SizeModeFactorProperty, value);
1519 NotifyPropertyChanged();
1524 /// Gets or sets the width resize policy to be used.
1526 /// <since_tizen> 3 </since_tizen>
1527 public ResizePolicyType WidthResizePolicy
1531 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1535 SetValue(WidthResizePolicyProperty, value);
1536 NotifyPropertyChanged();
1541 /// Gets or sets the height resize policy to be used.
1543 /// <since_tizen> 3 </since_tizen>
1544 public ResizePolicyType HeightResizePolicy
1548 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1552 SetValue(HeightResizePolicyProperty, value);
1553 NotifyPropertyChanged();
1558 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1559 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1561 /// <since_tizen> 3 </since_tizen>
1562 public SizeScalePolicyType SizeScalePolicy
1566 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1570 SetValue(SizeScalePolicyProperty, value);
1571 NotifyPropertyChanged();
1576 /// Gets or sets the status of whether the width size is dependent on the height size.
1578 /// <since_tizen> 3 </since_tizen>
1579 public bool WidthForHeight
1583 return (bool)GetValue(WidthForHeightProperty);
1587 SetValue(WidthForHeightProperty, value);
1588 NotifyPropertyChanged();
1593 /// Gets or sets the status of whether the height size is dependent on the width size.
1595 /// <since_tizen> 3 </since_tizen>
1596 public bool HeightForWidth
1600 return (bool)GetValue(HeightForWidthProperty);
1604 SetValue(HeightForWidthProperty, value);
1605 NotifyPropertyChanged();
1610 /// Gets or sets the padding for use in layout.
1613 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1615 /// <since_tizen> 5 </since_tizen>
1616 public Extents Padding
1620 // If View has a Layout then padding in stored in the base Layout class
1623 return Layout.Padding;
1627 Extents temp = (Extents)GetValue(PaddingProperty);
1628 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1630 // Two return points to prevent creating a zeroed Extent native object before assignment
1634 Extents padding = value;
1637 // Layout set so store Padding in LayoutItem instead of in View.
1638 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1639 // the position and sizes measure in the Layouting.
1640 Layout.Padding = value;
1641 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1642 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1643 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1645 padding = new Extents(0,0,0,0); // Reset value stored in View.
1647 _layout?.RequestLayout();
1649 SetValue(PaddingProperty, padding);
1650 NotifyPropertyChanged();
1651 _layout?.RequestLayout();
1656 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1659 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1661 /// <since_tizen> 3 </since_tizen>
1662 public Size2D MinimumSize
1666 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1667 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1671 if (_layout != null)
1673 // Note: it only works if minimum size is >= than natural size.
1674 // To force the size it should be done through the width&height spec or Size2D.
1675 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1676 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1677 _layout.RequestLayout();
1679 SetValue(MinimumSizeProperty, value);
1680 NotifyPropertyChanged();
1685 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1688 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1690 /// <since_tizen> 3 </since_tizen>
1691 public Size2D MaximumSize
1695 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1696 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1700 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1701 // MATCH_PARENT spec + parent container size can be used to limit
1702 if (_layout != null)
1704 _layout.RequestLayout();
1706 SetValue(MaximumSizeProperty, value);
1707 NotifyPropertyChanged();
1712 /// Gets or sets whether a child view inherits it's parent's position.<br />
1713 /// Default is to inherit.<br />
1714 /// 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 />
1716 /// <since_tizen> 3 </since_tizen>
1717 public bool InheritPosition
1721 return (bool)GetValue(InheritPositionProperty);
1725 SetValue(InheritPositionProperty, value);
1726 NotifyPropertyChanged();
1731 /// Gets or sets the clipping behavior (mode) of it's children.
1733 /// <since_tizen> 3 </since_tizen>
1734 public ClippingModeType ClippingMode
1738 return (ClippingModeType)GetValue(ClippingModeProperty);
1742 SetValue(ClippingModeProperty, value);
1743 NotifyPropertyChanged();
1748 /// Gets the number of renderers held by the view.
1750 /// <since_tizen> 3 </since_tizen>
1751 public uint RendererCount
1755 return GetRendererCount();
1760 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1763 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1765 /// <since_tizen> 3 </since_tizen>
1766 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1768 "View view = new View(); " +
1769 "view.PivotPoint = PivotPoint.Center; " +
1770 "view.PositionUsesPivotPoint = true;")]
1771 [EditorBrowsable(EditorBrowsableState.Never)]
1772 public Position AnchorPoint
1776 Position temp = new Position(0.0f, 0.0f, 0.0f);
1777 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1778 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1782 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1783 NotifyPropertyChanged();
1788 /// Sets the size of a view for the width, the height and the depth.<br />
1789 /// Geometry can be scaled to fit within this area.<br />
1790 /// This does not interfere with the view's scale factor.<br />
1791 /// The views default depth is the minimum of width and height.<br />
1795 /// Animatable - This property can be animated using <c>Animation</c> class.
1797 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1799 /// <since_tizen> 5 </since_tizen>
1804 Size tmp = (Size)GetValue(SizeProperty);
1805 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1809 SetValue(SizeProperty, value);
1810 NotifyPropertyChanged();
1815 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1817 /// <since_tizen> 3 </since_tizen>
1818 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1820 "Container parent = view.GetParent(); " +
1821 "View view = parent as View;")]
1822 [EditorBrowsable(EditorBrowsableState.Never)]
1823 public new View Parent
1828 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1829 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1830 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1832 if (basehandle is Layer layer)
1834 ret = new View(Layer.getCPtr(layer).Handle, false);
1835 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1839 ret = basehandle as View;
1842 Interop.BaseHandle.delete_BaseHandle(CPtr);
1843 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1845 if (NDalicPINVOKE.SWIGPendingException.Pending)
1846 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1852 /// Gets/Sets whether inherit parent's the layout Direction.
1854 /// <since_tizen> 4 </since_tizen>
1855 public bool InheritLayoutDirection
1859 return (bool)GetValue(InheritLayoutDirectionProperty);
1863 SetValue(InheritLayoutDirectionProperty, value);
1864 NotifyPropertyChanged();
1869 /// Gets/Sets the layout Direction.
1871 /// <since_tizen> 4 </since_tizen>
1872 public ViewLayoutDirectionType LayoutDirection
1876 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1880 SetValue(LayoutDirectionProperty, value);
1881 NotifyPropertyChanged();
1882 _layout?.RequestLayout();
1887 /// Gets or sets the Margin for use in layout.
1890 /// Margin property is supported by Layout algorithms and containers.
1891 /// Please Set Layout if you want to use Margin property.
1892 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1894 /// <since_tizen> 4 </since_tizen>
1895 public Extents Margin
1899 // If View has a Layout then margin is stored in Layout.
1902 return Layout.Margin;
1906 // If Layout not set then return margin stored in View.
1907 Extents temp = (Extents)GetValue(MarginProperty);
1908 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1910 // Two return points to prevent creating a zeroed Extent native object before assignment
1916 // Layout set so store Margin in LayoutItem instead of View.
1917 // If View stores the Margin too then the Legacy Size Negotiation will
1918 // overwrite the position and size values measured in the Layouting.
1919 Layout.Margin = value;
1920 SetValue(MarginProperty, new Extents(0,0,0,0));
1921 _layout?.RequestLayout();
1925 SetValue(MarginProperty, value);
1927 NotifyPropertyChanged();
1928 _layout?.RequestLayout();
1933 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1935 /// <since_tizen> 6 </since_tizen>
1936 public int WidthSpecification
1940 return _widthPolicy;
1944 _widthPolicy = value;
1945 if( _oldWidthPolicy != _widthPolicy )
1947 if (_widthPolicy >= 0)
1949 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1951 if(_heightPolicy>=0) // Policy an exact value
1953 Size2D.Width = _widthPolicy;
1957 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1958 // Size2D height will store the specification value (negative number) this will then be applied to the
1959 // HeightSpecification when the Size2D callback is invoked.
1960 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1963 _layout?.RequestLayout();
1964 _oldWidthPolicy = _widthPolicy;
1970 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1972 /// <since_tizen> 6 </since_tizen>
1973 public int HeightSpecification
1977 return _heightPolicy;
1981 _heightPolicy = value;
1982 if( _oldHeightPolicy != _heightPolicy )
1984 if (_heightPolicy >= 0)
1986 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1988 if(_widthPolicy>=0) // Policy an exact value
1990 Size2D.Height = _heightPolicy;
1994 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1995 // Size2D height will store the specification value (negative number) this will then be applied to the
1996 // HeightSpecification when the Size2D callback is invoked.
1997 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2001 _layout?.RequestLayout();
2002 _oldHeightPolicy = _heightPolicy;
2008 /// Gets the List of transitions for this View.
2010 /// <since_tizen> 6 </since_tizen>
2011 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2015 if (_layoutTransitions == null)
2017 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2019 return _layoutTransitions;
2024 /// Set a layout transitions for this View.
2027 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2029 /// <since_tizen> 6 </since_tizen>
2030 public LayoutTransition LayoutTransition
2034 if (_layoutTransitions == null)
2036 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2038 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2040 AttachTransitionsToChildren(value);
2045 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2048 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2050 /// <since_tizen> 4 </since_tizen>
2051 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2052 [EditorBrowsable(EditorBrowsableState.Never)]
2053 public Extents PaddingEX
2057 Extents temp = new Extents(0, 0, 0, 0);
2058 GetProperty(View.Property.PADDING).Get(temp);
2059 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2063 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2064 NotifyPropertyChanged();
2065 _layout?.RequestLayout();
2069 /// <since_tizen> 6 </since_tizen>
2070 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2071 [EditorBrowsable(EditorBrowsableState.Never)]
2072 public Style XamlStyle
2076 return (Style)GetValue(XamlStyleProperty);
2080 SetValue(XamlStyleProperty, value);
2085 /// The Color of View. This is an RGBA value.
2089 /// Animatable - This property can be animated using <c>Animation</c> class.
2091 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2093 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2094 [EditorBrowsable(EditorBrowsableState.Never)]
2099 Color temp = (Color)GetValue(ColorProperty);
2100 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2104 if (viewStyle != null)
2106 viewStyle.Color = value;
2110 SetValue(ColorProperty, value);
2113 NotifyPropertyChanged();
2118 /// Set the layout on this View. Replaces any existing Layout.
2120 /// <since_tizen> 6 </since_tizen>
2121 public LayoutItem Layout
2129 // Do nothing if layout provided is already set on this View.
2130 if (value == _layout)
2135 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2136 layoutingDisabled = false;
2139 // If new layout being set already has a owner then that owner receives a replacement default layout.
2140 // First check if the layout to be set already has a owner.
2141 if (value?.Owner != null)
2143 // Previous owner of the layout gets a default layout as a replacement.
2144 value.Owner.Layout = new AbsoluteLayout();
2146 // Copy Margin and Padding to replacement LayoutGroup.
2147 value.Owner.Layout.Margin = value.Margin;
2148 value.Owner.Layout.Padding = value.Padding;
2151 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2152 // View if no replacement. Previously margin and padding values would have been moved from
2153 // the View to the layout.
2154 if (_layout != null ) // Existing layout
2158 // Existing layout being replaced so copy over margin and padding values.
2159 value.Margin = _layout.Margin;
2160 value.Padding = _layout.Padding;
2164 // Layout not being replaced so restore margin and padding to View.
2165 SetValue(MarginProperty, _layout.Margin);
2166 SetValue(PaddingProperty, _layout.Padding);
2167 NotifyPropertyChanged();
2172 // First Layout to be added to the View hence copy
2174 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2177 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2179 // If View already has a margin set then store it in Layout instead.
2180 value.Margin = Margin;
2181 SetValue(MarginProperty, new Extents(0,0,0,0));
2182 NotifyPropertyChanged();
2185 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2187 // If View already has a padding set then store it in Layout instead.
2188 value.Padding = Padding;
2189 SetValue(PaddingProperty, new Extents(0,0,0,0));
2190 NotifyPropertyChanged();
2195 // Remove existing layout from it's parent layout group.
2196 _layout?.Unparent();
2198 // Set layout to this view
2204 /// The weight of the View, used to share available space in a layout with siblings.
2206 /// <since_tizen> 6 </since_tizen>
2216 _layout?.RequestLayout();
2221 /// Whether to load the BackgroundImage synchronously.
2222 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2223 /// Note: For Normal Quad images only.
2225 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2226 [EditorBrowsable(EditorBrowsableState.Never)]
2227 public bool BackgroundImageSynchronosLoading
2231 return _backgroundImageSynchronosLoading;
2235 _backgroundImageSynchronosLoading = value;
2238 Background.Find(Visual.Property.Type)?.Get(out visualType);
2239 if (visualType == (int)Visual.Type.Image)
2241 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2244 if (bgUrl.Length != 0)
2246 PropertyMap bgMap = this.Background;
2247 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2253 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2254 [EditorBrowsable(EditorBrowsableState.Never)]
2255 public Vector2 UpdateSizeHint
2259 return (Vector2)GetValue(UpdateSizeHintProperty);
2263 SetValue(UpdateSizeHintProperty, value);
2264 NotifyPropertyChanged();
2268 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2269 [EditorBrowsable(EditorBrowsableState.Never)]
2270 public string[] TransitionNames
2274 return transitionNames;
2278 transitionNames = value;
2284 /// Enable/Disable ControlState propagation for children.
2285 /// It is false by default.
2286 /// If the View needs to share ControlState with descendants, please set it true.
2287 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2289 [EditorBrowsable(EditorBrowsableState.Never)]
2290 public bool EnableControlStatePropagation
2292 get => controlStatePropagation;
2295 controlStatePropagation = value;
2297 foreach (View child in Children)
2299 child.EnableControlStatePropagation = value;
2305 /// Get Style, it is abstract function and must be override.
2307 /// <since_tizen> 6 </since_tizen>
2308 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2309 // TODO: It should be deprecated. please use CreateViewStyle instead.
2310 [EditorBrowsable(EditorBrowsableState.Never)]
2311 protected virtual ViewStyle GetViewStyle()
2313 return CreateViewStyle();
2317 /// Create Style, it is abstract function and must be override.
2319 [EditorBrowsable(EditorBrowsableState.Never)]
2320 protected virtual ViewStyle CreateViewStyle()
2322 return new ViewStyle();
2326 /// Called after the View's ControlStates changed.
2328 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2329 [EditorBrowsable(EditorBrowsableState.Never)]
2330 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2334 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2336 var view = (View)bindable;
2337 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2339 defaultValueCreator: (bindable) =>
2341 var view = (View)bindable;
2342 return view.backgroundImageSelector;
2344 private TriggerableSelector<string> _backgroundImageSelector;
2345 private TriggerableSelector<string> backgroundImageSelector
2349 if (null == _backgroundImageSelector)
2351 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2353 return _backgroundImageSelector;
2356 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2358 var view = (View)bindable;
2359 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2361 defaultValueCreator: (bindable) =>
2363 var view = (View)bindable;
2364 return view.backgroundColorSelector;
2366 private TriggerableSelector<Color> _backgroundColorSelector;
2367 private TriggerableSelector<Color> backgroundColorSelector
2371 if (null == _backgroundColorSelector)
2373 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2375 return _backgroundColorSelector;
2379 internal static readonly BindableProperty ColorSelectorProperty = BindableProperty.Create("ColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2381 var view = (View)bindable;
2382 view.colorSelector.Clone((Selector<Color>)newValue);
2384 defaultValueCreator: (bindable) =>
2386 var view = (View)bindable;
2387 return view.colorSelector;
2390 private TriggerableSelector<Color> _colorSelector;
2391 private TriggerableSelector<Color> colorSelector
2395 if (null == _colorSelector)
2397 _colorSelector = new TriggerableSelector<Color>(this, ColorProperty);
2399 return _colorSelector;
2403 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2405 var view = (View)bindable;
2406 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2408 defaultValueCreator: (bindable) =>
2410 var view = (View)bindable;
2411 return view.backgroundImageBorderSelector;
2413 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2414 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2418 if (null == _backgroundImageBorderSelector)
2420 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2422 return _backgroundImageBorderSelector;
2425 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2427 var view = (View)bindable;
2428 view.opacitySelector.Clone((Selector<float?>)newValue);
2430 defaultValueCreator: (bindable) =>
2432 var view = (View)bindable;
2433 return view.opacitySelector;
2435 private TriggerableSelector<float?> _opacitySelector;
2436 private TriggerableSelector<float?> opacitySelector
2440 if (null == _opacitySelector)
2442 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2444 return _opacitySelector;
2448 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2449 [EditorBrowsable(EditorBrowsableState.Never)]
2450 public virtual void ApplyStyle(ViewStyle viewStyle)
2452 if (null == viewStyle)
2457 if (this.viewStyle == viewStyle)
2462 if (null != this.viewStyle)
2464 simpleBinding.Clear();
2467 this.viewStyle = viewStyle;
2469 Dictionary<string, BindableProperty> bindablePropertyOfView;
2470 Type viewType = GetType();
2472 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2473 Type styleType = viewStyle.GetType();
2475 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2476 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2478 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2480 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2482 BindableProperty viewProperty;
2483 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2485 if (null != viewProperty)
2487 object value = viewStyle.GetValue(keyValuePair.Value);
2491 SetValue(viewProperty, value);
2494 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2500 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2501 [EditorBrowsable(EditorBrowsableState.Never)]
2502 private BundledPipe simpleBinding = new BundledPipe();