/* * Copyright(c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.InteropServices; using Tizen.NUI.Binding; using Tizen.NUI.Components; namespace Tizen.NUI.BaseComponents { /// /// View is the base class for all views. /// /// 3 public partial class View : Container, IResourcesProvider { /// /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout. /// /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public bool layoutSet = false; /// /// Flag to allow Layouting to be disabled for Views. /// Once a View has a Layout set then any children added to Views from then on will receive /// automatic Layouts. /// /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static bool layoutingDisabled{get; set;} = true; private LayoutItem _layout; // Exclusive layout assigned to this View. // List of transitions paired with the condition that uses the transition. private Dictionary _layoutTransitions; private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy private int _oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later private int _oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later private float _weight = 0.0f; // Weighting of child View in a Layout private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode private bool _backgroundImageSynchronosLoading = false; private Dictionary transDictionary = new Dictionary(); private string[] transitionNames; private bool controlStatePropagation = false; private ViewStyle viewStyle; internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set. internal BackgroundExtraData backgroundExtraData; static View() {} /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public ViewStyle ViewStyle { get { if (null == viewStyle) { ApplyStyle(GetViewStyle()); } return viewStyle; } } /// /// Creates a new instance of a view. /// /// 3 public View() : this(Interop.View.View_New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI). [EditorBrowsable(EditorBrowsableState.Never)] public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true) { ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone()); } /// /// Create a new instance of a View with setting the status of shown or hidden. /// /// false : Not displayed (hidden), true : displayed (shown) /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI). [EditorBrowsable(EditorBrowsableState.Never)] public View(bool shown) : this(Interop.View.View_New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); SetVisible(shown); } internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); if(!shown) { SetVisible(false); } backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData); } internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown) { ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone()); } internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn) { if (HasBody()) { PositionUsesPivotPoint = false; } _onWindowSendEventCallback = SendViewAddedEventToWindow; this.OnWindowSignal().Connect(_onWindowSendEventCallback); if (!shown) { SetVisible(false); } } internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); if (!shown) { SetVisible(false); } } /// /// The event that is triggered when the View's ControlState is changed. /// [EditorBrowsable(EditorBrowsableState.Never)] public event EventHandler ControlStateChangedEvent; internal event EventHandler ControlStateChangeEventInternal; private ControlState controlStates = ControlState.Normal; /// /// Get/Set the control state. /// /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public ControlState ControlState { get { return controlStates; } protected set { if (controlStates == value) { return; } var prevState = controlStates; controlStates = value; var changeInfo = new ControlStateChangedEventArgs(prevState, value); ControlStateChangeEventInternal?.Invoke(this, changeInfo); if (controlStatePropagation) { foreach (View child in Children) { child.ControlState = value; } } OnControlStateChanged(changeInfo); ControlStateChangedEvent?.Invoke(this, changeInfo); } } /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public bool IsResourcesCreated { get { return Application.Current.IsResourcesCreated; } } /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public ResourceDictionary XamlResources { get { return Application.Current.XamlResources; } set { Application.Current.XamlResources = value; } } /// /// The StyleName, type string. /// The value indicates DALi style name defined in json theme file. /// /// 3 public string StyleName { get { return (string)GetValue(StyleNameProperty); } set { SetValue(StyleNameProperty, value); NotifyPropertyChanged(); } } /// /// The KeyInputFocus, type bool. /// [EditorBrowsable(EditorBrowsableState.Never)] public bool KeyInputFocus { get { return (bool)GetValue(KeyInputFocusProperty); } set { SetValue(KeyInputFocusProperty, value); NotifyPropertyChanged(); } } /// /// The mutually exclusive with "backgroundImage" and "background" type Vector4. /// /// /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible. /// /// 3 public Color BackgroundColor { get { Color temp = (Color)GetValue(BackgroundColorProperty); return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A); } set { SetValue(BackgroundColorProperty, value); if (selectorData != null) { selectorData.BackgroundImage.Reset(this); selectorData.BackgroundColor.UpdateIfNeeds(this, value); } NotifyPropertyChanged(); } } /// /// The mutually exclusive with "backgroundColor" and "background" type Map. /// /// 3 public string BackgroundImage { get { return (string)GetValue(BackgroundImageProperty); } set { SetValue(BackgroundImageProperty, value); if (selectorData != null) { selectorData.BackgroundColor.Reset(this); selectorData.BackgroundImage.UpdateIfNeeds(this, value); } NotifyPropertyChanged(); } } /// /// Get or set the border of background image. /// /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public Rectangle BackgroundImageBorder { get { return (Rectangle)GetValue(BackgroundImageBorderProperty); } set { SetValue(BackgroundImageBorderProperty, value); selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value); NotifyPropertyChanged(); } } /// /// The background of view. /// /// 3 public Tizen.NUI.PropertyMap Background { get { return (PropertyMap)GetValue(BackgroundProperty); } set { SetValue(BackgroundProperty, value); NotifyPropertyChanged(); } } /// /// Describes a shadow as an image for a View. /// It is null by default. /// /// /// Getter returns copied instance of current shadow. /// /// /// The mutually exclusive with "BoxShadow". /// [EditorBrowsable(EditorBrowsableState.Never)] public ImageShadow ImageShadow { get { return (ImageShadow)GetValue(ImageShadowProperty); } set { SetValue(ImageShadowProperty, value); if (selectorData != null) { selectorData.BoxShadow.Reset(this); selectorData.ImageShadow.UpdateIfNeeds(this, value); } NotifyPropertyChanged(); } } /// /// Describes a box shaped shadow drawing for a View. /// It is null by default. /// /// /// Gettter returns copied instance of current shadow. /// /// /// The mutually exclusive with "ImageShadow". /// [EditorBrowsable(EditorBrowsableState.Never)] public Shadow BoxShadow { get { return (Shadow)GetValue(BoxShadowProperty); } set { SetValue(BoxShadowProperty, value); if (selectorData != null) { selectorData.ImageShadow.Reset(this); selectorData.BoxShadow.UpdateIfNeeds(this, value); } NotifyPropertyChanged(); } } /// /// The radius for the rounded corners of the View. /// This will rounds background and shadow edges. /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property. /// [EditorBrowsable(EditorBrowsableState.Never)] public float CornerRadius { get { return (float)GetValue(CornerRadiusProperty); } set { SetValue(CornerRadiusProperty, value); selectorData?.CornerRadius.UpdateIfNeeds(this, value); NotifyPropertyChanged(); } } /// /// The current state of the view. /// /// 3 public States State { get { return (States)GetValue(StateProperty); } set { SetValue(StateProperty, value); NotifyPropertyChanged(); } } /// /// The current sub state of the view. /// /// 3 public States SubState { get { return (States)GetValue(SubStateProperty); } set { SetValue(SubStateProperty, value); NotifyPropertyChanged(); } } /// /// Displays a tooltip /// /// 3 public Tizen.NUI.PropertyMap Tooltip { get { return (PropertyMap)GetValue(TooltipProperty); } set { SetValue(TooltipProperty, value); NotifyPropertyChanged(); } } /// /// Displays a tooltip as a text. /// /// 3 public string TooltipText { set { SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value)); NotifyPropertyChanged(); } } /// /// The Child property of FlexContainer.
/// The proportion of the free space in the container, the flex item will receive.
/// If all items in the container set this property, their sizes will be proportional to the specified flex factor.
///
/// 3 [Obsolete("Deprecated in API8, will be removed in API10.")] public float Flex { get { return (float)GetValue(FlexProperty); } set { SetValue(FlexProperty, value); NotifyPropertyChanged(); } } /// /// The Child property of FlexContainer.
/// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.
///
/// 3 [Obsolete("Deprecated in API8, will be removed in API10.")] public int AlignSelf { get { return (int)GetValue(AlignSelfProperty); } set { SetValue(AlignSelfProperty, value); NotifyPropertyChanged(); } } /// /// The Child property of FlexContainer.
/// The space around the flex item.
///
/// /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible. /// /// 3 [Obsolete("Deprecated in API8, will be removed in API10.")] public Vector4 FlexMargin { get { Vector4 temp = (Vector4)GetValue(FlexMarginProperty); return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W); } set { SetValue(FlexMarginProperty, value); NotifyPropertyChanged(); } } /// /// The top-left cell this child occupies, if not set, the first available cell is used. /// /// /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible. /// /// 3 public Vector2 CellIndex { get { Vector2 temp = (Vector2)GetValue(CellIndexProperty); return new Vector2(OnCellIndexChanged, temp.X, temp.Y); } set { SetValue(CellIndexProperty, value); NotifyPropertyChanged(); } } /// /// The number of rows this child occupies, if not set, the default value is 1. /// /// 3 public float RowSpan { get { return (float)GetValue(RowSpanProperty); } set { SetValue(RowSpanProperty, value); NotifyPropertyChanged(); } } /// /// The number of columns this child occupies, if not set, the default value is 1. /// /// 3 public float ColumnSpan { get { return (float)GetValue(ColumnSpanProperty); } set { SetValue(ColumnSpanProperty, value); NotifyPropertyChanged(); } } /// /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'. /// /// 3 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment { get { return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty); } set { SetValue(CellHorizontalAlignmentProperty, value); NotifyPropertyChanged(); } } /// /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'. /// /// 3 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment { get { return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty); } set { SetValue(CellVerticalAlignmentProperty, value); NotifyPropertyChanged(); } } /// /// The left focusable view.
/// This will return null if not set.
/// This will also return null if the specified left focusable view is not on a window.
///
/// 3 public View LeftFocusableView { // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. get { return (View)GetValue(LeftFocusableViewProperty); } set { SetValue(LeftFocusableViewProperty, value); NotifyPropertyChanged(); } } /// /// The right focusable view.
/// This will return null if not set.
/// This will also return null if the specified right focusable view is not on a window.
///
/// 3 public View RightFocusableView { // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. get { return (View)GetValue(RightFocusableViewProperty); } set { SetValue(RightFocusableViewProperty, value); NotifyPropertyChanged(); } } /// /// The up focusable view.
/// This will return null if not set.
/// This will also return null if the specified up focusable view is not on a window.
///
/// 3 public View UpFocusableView { // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. get { return (View)GetValue(UpFocusableViewProperty); } set { SetValue(UpFocusableViewProperty, value); NotifyPropertyChanged(); } } /// /// The down focusable view.
/// This will return null if not set.
/// This will also return null if the specified down focusable view is not on a window.
///
/// 3 public View DownFocusableView { // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. get { return (View)GetValue(DownFocusableViewProperty); } set { SetValue(DownFocusableViewProperty, value); NotifyPropertyChanged(); } } /// /// Whether the view should be focusable by keyboard navigation. /// /// 3 public bool Focusable { set { SetValue(FocusableProperty, value); NotifyPropertyChanged(); } get { return (bool)GetValue(FocusableProperty); } } /// /// Retrieves the position of the view.
/// The coordinates are relative to the view's parent.
///
/// 3 public Position CurrentPosition { get { return GetCurrentPosition(); } } /// /// Sets the size of a view for the width and the height.
/// Geometry can be scaled to fit within this area.
/// This does not interfere with the view's scale factor.
/// The views default depth is the minimum of width and height.
///
/// /// This NUI object (Size2D) typed property can be configured by multiple cascade setting.
/// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ).
///
/// 3 public Size2D Size2D { get { Size2D temp = (Size2D)GetValue(Size2DProperty); if (this.Layout == null) { if (temp.Width < 0) { temp.Width = 0; } if (temp.Height < 0) { temp.Height = 0; } } return new Size2D(OnSize2DChanged, temp.Width, temp.Height); } set { sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set. SetValue(Size2DProperty, value); // Set Specification so when layouts measure this View it matches the value set here. // All Views are currently Layouts. MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly); MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly); _widthPolicy = value.Width; _heightPolicy = value.Height; _layout?.RequestLayout(); NotifyPropertyChanged(); } } /// /// Retrieves the size of the view.
/// The coordinates are relative to the view's parent.
///
/// 3 public Size2D CurrentSize { get { return GetCurrentSize(); } } /// /// Retrieves and sets the view's opacity.
///
/// 3 public float Opacity { get { return (float)GetValue(OpacityProperty); } set { SetValue(OpacityProperty, value); selectorData?.Opacity.UpdateIfNeeds(this, value); NotifyPropertyChanged(); } } /// /// Sets the position of the view for X and Y.
/// By default, sets the position vector between the parent origin and the pivot point (default).
/// If the position inheritance is disabled, sets the world position.
///
/// /// This NUI object (Position2D) typed property can be configured by multiple cascade setting.
/// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ).
///
/// 3 public Position2D Position2D { get { Position2D temp = (Position2D)GetValue(Position2DProperty); return new Position2D(OnPosition2DChanged, temp.X, temp.Y); } set { SetValue(Position2DProperty, value); NotifyPropertyChanged(); } } /// /// Retrieves the screen postion of the view.
///
/// 3 public Vector2 ScreenPosition { get { Vector2 temp = new Vector2(0.0f, 0.0f); GetProperty(View.Property.SCREEN_POSITION).Get(temp); return temp; } } /// /// Determines whether the pivot point should be used to determine the position of the view. /// This is false by default. /// /// If false, then the top-left of the view is used for the position. /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position. /// /// 3 public bool PositionUsesPivotPoint { get { return (bool)GetValue(PositionUsesPivotPointProperty); } set { SetValue(PositionUsesPivotPointProperty, value); NotifyPropertyChanged(); } } /// /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! /// /// 3 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " + "Like: " + "View view = new View(); " + "view.PivotPoint = PivotPoint.Center; " + "view.PositionUsesPivotPoint = true;" + " Deprecated in API5: Will be removed in API8")] [EditorBrowsable(EditorBrowsableState.Never)] public bool PositionUsesAnchorPoint { get { bool temp = false; GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp); return temp; } set { SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value)); NotifyPropertyChanged(); } } /// /// Queries whether the view is connected to the stage.
/// When a view is connected, it will be directly or indirectly parented to the root view.
///
/// 3 public bool IsOnWindow { get { return OnWindow(); } } /// /// Gets the depth in the hierarchy for the view. /// /// 3 public int HierarchyDepth { get { return GetHierarchyDepth(); } } /// /// Sets the sibling order of the view so the depth position can be defined within the same parent. /// /// /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0. /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order. /// The values set by this property will likely change. /// /// 3 public int SiblingOrder { get { return (int)GetValue(SiblingOrderProperty); } set { SetValue(SiblingOrderProperty, value); LayoutGroup layout = Layout as LayoutGroup; layout?.ChangeLayoutSiblingOrder(value); NotifyPropertyChanged(); } } /// /// Returns the natural size of the view. /// /// /// Deriving classes stipulate the natural size and by default a view has a zero natural size. /// /// 5 public Vector3 NaturalSize { get { Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } } /// /// Returns the natural size (Size2D) of the view. /// /// /// Deriving classes stipulate the natural size and by default a view has a zero natural size. /// /// 4 public Size2D NaturalSize2D { get { Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return new Size2D((int)temp.Width, (int)temp.Height); } } /// /// Gets or sets the origin of a view within its parent's area.
/// 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.
/// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).
/// A view's position is the distance between this origin and the view's anchor-point.
///
///
The view has been initialized.
/// 3 public Position ParentOrigin { get { Position tmp = (Position)GetValue(ParentOriginProperty); return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z); } set { SetValue(ParentOriginProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the anchor-point of a view.
/// 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.
/// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).
/// A view position is the distance between its parent-origin and this anchor-point.
/// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.
///
The view has been initialized.
///
/// /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible. /// /// 3 public Position PivotPoint { get { Position tmp = (Position)GetValue(PivotPointProperty); return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z); } set { SetValue(PivotPointProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the size width of the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// /// 3 public float SizeWidth { get { return (float)GetValue(SizeWidthProperty); } set { SetValue(SizeWidthProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the size height of the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// /// 3 public float SizeHeight { get { return (float)GetValue(SizeHeightProperty); } set { SetValue(SizeHeightProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the position of the view.
/// By default, sets the position vector between the parent origin and pivot point (default).
/// If the position inheritance is disabled, sets the world position.
///
/// /// /// Animatable - This property can be animated using Animation class. /// /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible. /// /// 3 public Position Position { get { Position tmp = (Position)GetValue(PositionProperty); return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z); } set { SetValue(PositionProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the position X of the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// /// 3 public float PositionX { get { return (float)GetValue(PositionXProperty); } set { SetValue(PositionXProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the position Y of the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// /// 3 public float PositionY { get { return (float)GetValue(PositionYProperty); } set { SetValue(PositionYProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the position Z of the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// /// 3 public float PositionZ { get { return (float)GetValue(PositionZProperty); } set { SetValue(PositionZProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the world position of the view. /// /// 3 public Vector3 WorldPosition { get { Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); GetProperty(View.Property.WORLD_POSITION).Get(temp); return temp; } } /// /// Gets or sets the orientation of the view.
/// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.
///
/// /// /// This is an asynchronous method. /// /// /// Animatable - This property can be animated using Animation class. /// /// /// 3 public Rotation Orientation { get { return (Rotation)GetValue(OrientationProperty); } set { SetValue(OrientationProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the world orientation of the view.
///
/// 3 public Rotation WorldOrientation { get { Rotation temp = new Rotation(); GetProperty(View.Property.WORLD_ORIENTATION).Get(temp); return temp; } } /// /// Gets or sets the scale factor applied to the view.
///
/// /// /// Animatable - This property can be animated using Animation class. /// /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible. /// /// 3 public Vector3 Scale { get { Vector3 temp = (Vector3)GetValue(ScaleProperty); return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z); } set { SetValue(ScaleProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the scale X factor applied to the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// /// 3 public float ScaleX { get { return (float)GetValue(ScaleXProperty); } set { SetValue(ScaleXProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the scale Y factor applied to the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// /// 3 public float ScaleY { get { return (float)GetValue(ScaleYProperty); } set { SetValue(ScaleYProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the scale Z factor applied to the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// /// 3 public float ScaleZ { get { return (float)GetValue(ScaleZProperty); } set { SetValue(ScaleZProperty, value); NotifyPropertyChanged(); } } /// /// Gets the world scale of the view. /// /// 3 public Vector3 WorldScale { get { Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); GetProperty(View.Property.WORLD_SCALE).Get(temp); return temp; } } /// /// Retrieves the visibility flag of the view. /// /// /// /// If the view is not visible, then the view and its children will not be rendered. /// 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. /// /// /// Animatable - This property can be animated using Animation class. /// /// /// 3 public bool Visibility { get { bool temp = false; GetProperty(View.Property.VISIBLE).Get(out temp); return temp; } } /// /// Gets the view's world color. /// /// 3 public Vector4 WorldColor { get { Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); GetProperty(View.Property.WORLD_COLOR).Get(temp); return temp; } } /// /// Gets or sets the view's name. /// /// 3 public string Name { get { return (string)GetValue(NameProperty); } set { SetValue(NameProperty, value); NotifyPropertyChanged(); } } /// /// Get the number of children held by the view. /// /// 3 public new uint ChildCount { get { return GetChildCount(); } } /// /// Gets the view's ID. /// Readonly /// /// 3 public uint ID { get { return GetId(); } } /// /// Gets or sets the status of whether the view should emit touch or hover signals. /// /// 3 public bool Sensitive { get { return (bool)GetValue(SensitiveProperty); } set { SetValue(SensitiveProperty, value); NotifyPropertyChanged(); } } /// /// 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. /// /// 3 public bool LeaveRequired { get { return (bool)GetValue(LeaveRequiredProperty); } set { SetValue(LeaveRequiredProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the status of whether a child view inherits it's parent's orientation. /// /// 3 public bool InheritOrientation { get { return (bool)GetValue(InheritOrientationProperty); } set { SetValue(InheritOrientationProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the status of whether a child view inherits it's parent's scale. /// /// 3 public bool InheritScale { get { return (bool)GetValue(InheritScaleProperty); } set { SetValue(InheritScaleProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the status of how the view and its children should be drawn.
/// Not all views are renderable, but DrawMode can be inherited from any view.
/// 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.
/// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.
/// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.
/// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.
///
/// 3 public DrawModeType DrawMode { get { return (DrawModeType)GetValue(DrawModeProperty); } set { SetValue(DrawModeProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the relative to parent size factor of the view.
/// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.
/// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.
///
/// /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible. /// /// 3 public Vector3 SizeModeFactor { get { Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty); return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z); } set { SetValue(SizeModeFactorProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the width resize policy to be used. /// /// 3 public ResizePolicyType WidthResizePolicy { get { return (ResizePolicyType)GetValue(WidthResizePolicyProperty); } set { SetValue(WidthResizePolicyProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the height resize policy to be used. /// /// 3 public ResizePolicyType HeightResizePolicy { get { return (ResizePolicyType)GetValue(HeightResizePolicyProperty); } set { SetValue(HeightResizePolicyProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the policy to use when setting size with size negotiation.
/// Defaults to SizeScalePolicyType.UseSizeSet.
///
/// 3 public SizeScalePolicyType SizeScalePolicy { get { return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty); } set { SetValue(SizeScalePolicyProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the status of whether the width size is dependent on the height size. /// /// 3 public bool WidthForHeight { get { return (bool)GetValue(WidthForHeightProperty); } set { SetValue(WidthForHeightProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the status of whether the height size is dependent on the width size. /// /// 3 public bool HeightForWidth { get { return (bool)GetValue(HeightForWidthProperty); } set { SetValue(HeightForWidthProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the padding for use in layout. /// /// /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible. /// /// 5 public Extents Padding { get { // If View has a Layout then padding in stored in the base Layout class if (Layout != null) { return Layout.Padding; } else { Extents temp = (Extents)GetValue(PaddingProperty); return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom); } // Two return points to prevent creating a zeroed Extent native object before assignment } set { Extents padding = value; if (Layout != null) { // Layout set so store Padding in LayoutItem instead of in View. // If View stores the Padding value then Legacy Size Negotiation will overwrite // the position and sizes measure in the Layouting. Layout.Padding = value; // If Layout is a LayoutItem then it could be a View that handles it's own padding. // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths. if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind. { padding = new Extents(0, 0, 0, 0); // Reset value stored in View. } } SetValue(PaddingProperty, padding); NotifyPropertyChanged(); } } /// /// Gets or sets the minimum size the view can be assigned in size negotiation. /// /// /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible. /// /// 3 public Size2D MinimumSize { get { Size2D tmp = (Size2D)GetValue(MinimumSizeProperty); return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height); } set { if (_layout != null) { // Note: it only works if minimum size is >= than natural size. // To force the size it should be done through the width&height spec or Size2D. _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width); _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height); _layout.RequestLayout(); } SetValue(MinimumSizeProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the maximum size the view can be assigned in size negotiation. /// /// /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible. /// /// 3 public Size2D MaximumSize { get { Size2D tmp = (Size2D)GetValue(MaximumSizeProperty); return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height); } set { // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout. // MATCH_PARENT spec + parent container size can be used to limit if (_layout != null) { _layout.RequestLayout(); } SetValue(MaximumSizeProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets whether a child view inherits it's parent's position.
/// Default is to inherit.
/// 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.
///
/// 3 public bool InheritPosition { get { return (bool)GetValue(InheritPositionProperty); } set { SetValue(InheritPositionProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the clipping behavior (mode) of it's children. /// /// 3 public ClippingModeType ClippingMode { get { return (ClippingModeType)GetValue(ClippingModeProperty); } set { SetValue(ClippingModeProperty, value); NotifyPropertyChanged(); } } /// /// Gets the number of renderers held by the view. /// /// 3 public uint RendererCount { get { return GetRendererCount(); } } /// /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! /// /// /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible. /// /// 3 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " + "Like: " + "View view = new View(); " + "view.PivotPoint = PivotPoint.Center; " + "view.PositionUsesPivotPoint = true;")] [EditorBrowsable(EditorBrowsableState.Never)] public Position AnchorPoint { get { Position temp = new Position(0.0f, 0.0f, 0.0f); GetProperty(View.Property.ANCHOR_POINT).Get(temp); return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z); } set { SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value)); NotifyPropertyChanged(); } } /// /// Sets the size of a view for the width, the height and the depth.
/// Geometry can be scaled to fit within this area.
/// This does not interfere with the view's scale factor.
/// The views default depth is the minimum of width and height.
///
/// /// /// Animatable - This property can be animated using Animation class. /// /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible. /// /// 5 public Size Size { get { Size tmp = (Size)GetValue(SizeProperty); return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth); } set { SetValue(SizeProperty, value); NotifyPropertyChanged(); } } /// /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! /// /// 3 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " + "Like: " + "Container parent = view.GetParent(); " + "View view = parent as View;")] [EditorBrowsable(EditorBrowsableState.Never)] public new View Parent { get { View ret; IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr); HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle); if (basehandle is Layer layer) { ret = new View(Layer.getCPtr(layer).Handle, false); NUILog.Error("This Parent property is deprecated, shoud do not be used"); } else { ret = basehandle as View; } Interop.BaseHandle.delete_BaseHandle(CPtr); CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } } /// /// Gets/Sets whether inherit parent's the layout Direction. /// /// 4 public bool InheritLayoutDirection { get { return (bool)GetValue(InheritLayoutDirectionProperty); } set { SetValue(InheritLayoutDirectionProperty, value); NotifyPropertyChanged(); } } /// /// Gets/Sets the layout Direction. /// /// 4 public ViewLayoutDirectionType LayoutDirection { get { return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty); } set { SetValue(LayoutDirectionProperty, value); NotifyPropertyChanged(); _layout?.RequestLayout(); } } /// /// Gets or sets the Margin for use in layout. /// /// /// Margin property is supported by Layout algorithms and containers. /// Please Set Layout if you want to use Margin property. /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible. /// /// 4 public Extents Margin { get { // If View has a Layout then margin is stored in Layout. if (Layout != null) { return Layout.Margin; } else { // If Layout not set then return margin stored in View. Extents temp = (Extents)GetValue(MarginProperty); return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom); } // Two return points to prevent creating a zeroed Extent native object before assignment } set { if (Layout != null) { // Layout set so store Margin in LayoutItem instead of View. // If View stores the Margin too then the Legacy Size Negotiation will // overwrite the position and size values measured in the Layouting. Layout.Margin = value; SetValue(MarginProperty, new Extents(0,0,0,0)); _layout?.RequestLayout(); } else { SetValue(MarginProperty, value); } NotifyPropertyChanged(); _layout?.RequestLayout(); } } /// /// The required policy for this dimension, LayoutParamPolicies enum or exact value. /// /// 6 public int WidthSpecification { get { return _widthPolicy; } set { _widthPolicy = value; if( _oldWidthPolicy != _widthPolicy ) { if (_widthPolicy >= 0) { _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly ); if(_heightPolicy>=0) // Policy an exact value { // Create Size2D only both _widthPolicy and _heightPolicy are set. Size2D = new Size2D(_widthPolicy,_heightPolicy); } } _layout?.RequestLayout(); _oldWidthPolicy = _widthPolicy; } } } /// /// The required policy for this dimension, LayoutParamPolicies enum or exact value. /// /// 6 public int HeightSpecification { get { return _heightPolicy; } set { _heightPolicy = value; if( _oldHeightPolicy != _heightPolicy ) { if (_heightPolicy >= 0) { _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly ); if(_widthPolicy>=0) // Policy an exact value { // Create Size2D only both _widthPolicy and _heightPolicy are set. Size2D = new Size2D(_widthPolicy,_heightPolicy); } } _layout?.RequestLayout(); _oldHeightPolicy = _heightPolicy; } } } /// /// Gets the List of transitions for this View. /// /// 6 public Dictionary LayoutTransitions { get { if (_layoutTransitions == null) { _layoutTransitions = new Dictionary(); } return _layoutTransitions; } } /// /// Set a layout transitions for this View. /// /// /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View. /// /// 6 public LayoutTransition LayoutTransition { set { if (_layoutTransitions == null) { _layoutTransitions = new Dictionary(); } LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true); AttachTransitionsToChildren(value); } } /// /// Deprecated in API5; Will be removed in API8. Please use Padding instead. /// /// /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible. /// /// 4 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")] [EditorBrowsable(EditorBrowsableState.Never)] public Extents PaddingEX { get { Extents temp = new Extents(0, 0, 0, 0); GetProperty(View.Property.PADDING).Get(temp); return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom); } set { SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value)); NotifyPropertyChanged(); _layout?.RequestLayout(); } } /// 6 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public Style XamlStyle { get { return (Style)GetValue(XamlStyleProperty); } set { SetValue(XamlStyleProperty, value); } } /// /// The Color of View. This is an RGBA value. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible. /// /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public Color Color { get { Color temp = (Color)GetValue(ColorProperty); return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A); } set { SetValue(ColorProperty, value); selectorData?.Color.UpdateIfNeeds(this, value); NotifyPropertyChanged(); } } /// /// Set the layout on this View. Replaces any existing Layout. /// /// 6 public LayoutItem Layout { get { return _layout; } set { // Do nothing if layout provided is already set on this View. if (value == _layout) { return; } Log.Info("NUI", "Setting Layout on:" + Name + "\n"); layoutingDisabled = false; layoutSet = true; // If new layout being set already has a owner then that owner receives a replacement default layout. // First check if the layout to be set already has a owner. if (value?.Owner != null) { // Previous owner of the layout gets a default layout as a replacement. value.Owner.Layout = new AbsoluteLayout(); // Copy Margin and Padding to replacement LayoutGroup. if (value.Owner.Layout != null) { value.Owner.Layout.Margin = value.Margin; value.Owner.Layout.Padding = value.Padding; } } // Copy Margin and Padding to new layout being set or restore padding and margin back to // View if no replacement. Previously margin and padding values would have been moved from // the View to the layout. if (_layout != null ) // Existing layout { if (value != null) { // Existing layout being replaced so copy over margin and padding values. value.Margin = _layout.Margin; value.Padding = _layout.Padding; } else { // Layout not being replaced so restore margin and padding to View. SetValue(MarginProperty, _layout.Margin); SetValue(PaddingProperty, _layout.Padding); NotifyPropertyChanged(); } } else { // First Layout to be added to the View hence copy // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View) if (value !=null) { if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0) { // If View already has a margin set then store it in Layout instead. value.Margin = Margin; SetValue(MarginProperty, new Extents(0,0,0,0)); NotifyPropertyChanged(); } if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0) { // If View already has a padding set then store it in Layout instead. value.Padding = Padding; SetValue(PaddingProperty, new Extents(0,0,0,0)); NotifyPropertyChanged(); } } } // Remove existing layout from it's parent layout group. _layout?.Unparent(); // Set layout to this view SetLayout(value); } } /// /// The weight of the View, used to share available space in a layout with siblings. /// /// 6 public float Weight { get { return _weight; } set { _weight = value; _layout?.RequestLayout(); } } /// /// Whether to load the BackgroundImage synchronously. /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously. /// Note: For Normal Quad images only. /// /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public bool BackgroundImageSynchronosLoading { get { return _backgroundImageSynchronosLoading; } set { _backgroundImageSynchronosLoading = value; string bgUrl = null; Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl); if (!string.IsNullOrEmpty(bgUrl)) { PropertyMap bgMap = this.Background; bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading)); Background = bgMap; } } } /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public Vector2 UpdateSizeHint { get { return (Vector2)GetValue(UpdateSizeHintProperty); } set { SetValue(UpdateSizeHintProperty, value); NotifyPropertyChanged(); } } /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public string[] TransitionNames { get { return transitionNames; } set { transitionNames = value; LoadTransitions(); } } /// /// Enable/Disable ControlState propagation for children. /// It is false by default. /// If the View needs to share ControlState with descendants, please set it true. /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively. /// [EditorBrowsable(EditorBrowsableState.Never)] public bool EnableControlStatePropagation { get => controlStatePropagation; set { controlStatePropagation = value; foreach (View child in Children) { child.EnableControlStatePropagation = value; } } } /// /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch. /// By default, it is false in View, true in Control. /// Note that if the value is true, the View will be a touch receptor. /// [EditorBrowsable(EditorBrowsableState.Never)] public bool EnableControlState { get { return (bool)GetValue(EnableControlStateProperty); } set { SetValue(EnableControlStateProperty, value); } } /// /// Whether the actor grab all touches even if touch leaves its boundary. /// /// true, if it grab all touch after start [EditorBrowsable(EditorBrowsableState.Never)] public bool GrabTouchAfterLeave { get { bool temp = false; GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp); return temp; } set { SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value)); NotifyPropertyChanged(); } } /// /// Get Style, it is abstract function and must be override. /// /// 6 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. // TODO: It should be deprecated. please use CreateViewStyle instead. [EditorBrowsable(EditorBrowsableState.Never)] protected virtual ViewStyle GetViewStyle() { return CreateViewStyle(); } /// /// Create Style, it is abstract function and must be override. /// [EditorBrowsable(EditorBrowsableState.Never)] protected virtual ViewStyle CreateViewStyle() { return new ViewStyle(); } /// /// Called after the View's ControlStates changed. /// /// The information including state changed variables. [EditorBrowsable(EditorBrowsableState.Never)] protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo) { } /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public virtual void ApplyStyle(ViewStyle viewStyle) { if (null == viewStyle || this.viewStyle == viewStyle) return; this.viewStyle = viewStyle; Dictionary bindablePropertyOfView; Type viewType = GetType(); Dictionary bindablePropertyOfStyle; Type styleType = viewStyle.GetType(); BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView); BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle); if (null != bindablePropertyOfView && null != bindablePropertyOfStyle) { foreach (KeyValuePair keyValuePair in bindablePropertyOfStyle) { BindableProperty viewProperty; bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty); if (null != viewProperty) { object value = viewStyle.GetValue(keyValuePair.Value); if (null != value) { SetValue(viewProperty, value); } } } } } } }