[NUI] Theme change do not overwrite user set properties. (#2731)
authorJiyun Yang <ji.yang@samsung.com>
Mon, 15 Mar 2021 02:24:41 +0000 (11:24 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Wed, 17 Mar 2021 06:50:14 +0000 (15:50 +0900)
* [NUI] Theme change do not overwrite user set properties.

* Note that this works only for the bindable properties.

Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
* [NUI] Components share style instance in a theme

Hence a component should not modify connected style instance.

37 files changed:
src/Tizen.NUI.Components/Controls/Button.Internal.cs
src/Tizen.NUI.Components/Controls/Button.cs
src/Tizen.NUI.Components/Controls/CheckBox.cs
src/Tizen.NUI.Components/Controls/Control.cs
src/Tizen.NUI.Components/Controls/FlexibleView/FlexibleView.cs
src/Tizen.NUI.Components/Controls/ImageScrollBar.cs
src/Tizen.NUI.Components/Controls/Loading.cs
src/Tizen.NUI.Components/Controls/Pagination.cs
src/Tizen.NUI.Components/Controls/Popup.cs
src/Tizen.NUI.Components/Controls/Progress.cs
src/Tizen.NUI.Components/Controls/RadioButton.cs
src/Tizen.NUI.Components/Controls/RecyclerView/Item/DefaultGridItem.cs
src/Tizen.NUI.Components/Controls/RecyclerView/Item/DefaultLinearItem.cs
src/Tizen.NUI.Components/Controls/RecyclerView/Item/DefaultTitleItem.cs
src/Tizen.NUI.Components/Controls/RecyclerView/Item/RecyclerViewItem.cs
src/Tizen.NUI.Components/Controls/Scrollbar.cs
src/Tizen.NUI.Components/Controls/SelectButton.cs
src/Tizen.NUI.Components/Controls/Slider.Internal.cs
src/Tizen.NUI.Components/Controls/Slider.cs
src/Tizen.NUI.Components/Controls/Switch.cs
src/Tizen.NUI.Components/Controls/Tab.cs
src/Tizen.NUI.Components/Controls/Toast.cs
src/Tizen.NUI.Components/Style/PaginationStyle.cs
src/Tizen.NUI.Components/Theme/DefaultThemeCommon.cs
src/Tizen.NUI.Wearable/src/public/CircularPagination.cs
src/Tizen.NUI.Wearable/src/public/CircularProgress.cs
src/Tizen.NUI.Wearable/src/public/CircularScrollbar.cs
src/Tizen.NUI.Wearable/src/public/CircularSlider.cs
src/Tizen.NUI.Wearable/src/public/Title.cs
src/Tizen.NUI/src/public/BaseComponents/CustomView.cs
src/Tizen.NUI/src/public/BaseComponents/Style/Selector.cs
src/Tizen.NUI/src/public/BaseComponents/Style/ViewStyle.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs
src/Tizen.NUI/src/public/CustomView/ViewWrapper.cs
src/Tizen.NUI/src/public/Theme/Theme.cs
src/Tizen.NUI/src/public/Theme/ThemeManager.cs

index 8ddec6d..f4fd6c1 100755 (executable)
@@ -410,6 +410,16 @@ namespace Tizen.NUI.Components
         {
             base.OnInitialize();
             SetAccessibilityConstructor(Role.PushButton);
+
+            AccessibilityHighlightable = true;
+            EnableControlStatePropagation = true;
+            LayoutDirectionChanged += OnLayoutDirectionChanged;
+
+            AccessibilityManager.Instance.SetAccessibilityAttribute(this, AccessibilityManager.AccessibilityAttribute.Trait, "Button");
+
+#if PROFILE_MOBILE
+            Feedback = true;
+#endif
         }
 
         /// <inheritdoc/>
@@ -433,24 +443,6 @@ namespace Tizen.NUI.Components
             }
         }
 
-        /// <summary>
-        /// It is hijack by using protected, style copy problem when class inherited from Button.
-        /// </summary>
-        /// <since_tizen> 6 </since_tizen>
-        private void Initialize()
-        {
-            AccessibilityHighlightable = true;
-            EnableControlStatePropagation = true;
-            UpdateState();
-            LayoutDirectionChanged += OnLayoutDirectionChanged;
-
-            AccessibilityManager.Instance.SetAccessibilityAttribute(this, AccessibilityManager.AccessibilityAttribute.Trait, "Button");
-
-#if PROFILE_MOBILE
-                Feedback = true;
-#endif
-        }
-
         private void UpdateUIContent()
         {
             MeasureText();
index 3be84d7..ed56c0a 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
@@ -75,12 +75,6 @@ namespace Tizen.NUI.Components
                 if (instance.isEnabled != newEnabled)
                 {
                     instance.isEnabled = newEnabled;
-
-                    if (instance.buttonStyle != null)
-                    {
-                        instance.buttonStyle.IsEnabled = newEnabled;
-                    }
-
                     instance.UpdateState();
                 }
             }
@@ -98,11 +92,6 @@ namespace Tizen.NUI.Components
                 {
                     instance.isSelected = newSelected;
 
-                    if (instance.buttonStyle != null)
-                    {
-                        instance.buttonStyle.IsSelected = newSelected;
-                    }
-
                     if (instance.isSelectable)
                     {
                         instance.UpdateState();
@@ -126,12 +115,6 @@ namespace Tizen.NUI.Components
                 if (instance.isSelectable != newSelectable)
                 {
                     instance.isSelectable = newSelectable;
-
-                    if (instance.buttonStyle != null)
-                    {
-                        instance.buttonStyle.IsSelectable = newSelectable;
-                    }
-
                     instance.UpdateState();
                 }
             }
@@ -173,7 +156,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public Button() : base()
         {
-            Initialize();
         }
 
         /// <summary>
@@ -183,7 +165,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Button(string style) : base(style)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -193,7 +174,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Button(ButtonStyle buttonStyle) : base(buttonStyle)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -352,25 +332,13 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// Return a copied Style instance of Button
+        /// Return currently applied style.
         /// </summary>
         /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the Button.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
+        /// Modifying contents in style may cause unexpected behaviour.
         /// </remarks>
         /// <since_tizen> 8 </since_tizen>
-        public new ButtonStyle Style
-        {
-            get
-            {
-                var result = (ButtonStyle)ViewStyle.Clone();
-                result.CopyPropertiesFromView(this);
-                result.Text.CopyPropertiesFromView(TextLabel);
-                result.Icon.CopyPropertiesFromView(Icon);
-                result.Overlay.CopyPropertiesFromView(OverlayImage);
-                return result;
-            }
-        }
+        public ButtonStyle Style => (ButtonStyle)(ViewStyle as ButtonStyle)?.Clone();
 
         /// <summary>
         /// The text of Button.
@@ -683,8 +651,6 @@ namespace Tizen.NUI.Components
             set => SetValue(TextPaddingProperty, value);
         }
 
-        private ButtonStyle buttonStyle => ViewStyle as ButtonStyle;
-
         /// <summary>
         /// Called after a key event is received by the view that has had its focus set.
         /// </summary>
@@ -779,7 +745,7 @@ namespace Tizen.NUI.Components
 
             base.ApplyStyle(viewStyle);
 
-            if (null != buttonStyle)
+            if (viewStyle is ButtonStyle buttonStyle)
             {
                 Extension = buttonStyle.CreateExtension();
                 if (buttonStyle.Overlay != null)
@@ -799,6 +765,7 @@ namespace Tizen.NUI.Components
             }
 
             styleApplied = true;
+            UpdateState();
         }
 
         /// <summary>
index 55b0a27..9af37fd 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
@@ -50,6 +50,7 @@ namespace Tizen.NUI.Components
         public override void OnInitialize()
         {
             base.OnInitialize();
+
             SetAccessibilityConstructor(Role.CheckBox);
         }
 
@@ -73,21 +74,6 @@ namespace Tizen.NUI.Components
 
         /// <inheritdoc/>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public override void ApplyStyle(ViewStyle viewStyle)
-        {
-            if (viewStyle is ButtonStyle buttonStyle)
-            {
-                if (buttonStyle.IsSelectable == null)
-                {
-                    buttonStyle.IsSelectable = true;
-                }
-
-                base.ApplyStyle(buttonStyle);
-            }
-        }
-
-        /// <inheritdoc/>
-        [EditorBrowsable(EditorBrowsableState.Never)]
         protected override ImageView CreateIcon()
         {
             return new ImageView
index 1eba802..5f07a78 100755 (executable)
@@ -46,10 +46,6 @@ namespace Tizen.NUI.Components
 
         private Feedback feedback = null;
 
-        /// 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 ControlStyle Style => (ControlStyle)ViewStyle.Clone();
-
         static Control()
         {
             ThemeManager.AddPackageTheme(DefaultThemeCreator.Instance);
@@ -83,7 +79,6 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public Control(ControlStyle style) : base(style)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -93,15 +88,14 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         /// 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 Control(string styleName) : this(ThemeManager.GetStyle(styleName) as ControlStyle)
+        public Control(string styleName) : this(new ControlStyle() /* Apply empty style */)
         {
             if (ThemeManager.GetStyle(styleName) == null)
             {
                 throw new InvalidOperationException($"There is no style {styleName}");
             }
 
-            this.styleName = styleName;
-            ThemeChangeSensitive = true;
+            StyleName = styleName;
         }
 
         /// <summary>
@@ -207,12 +201,14 @@ namespace Tizen.NUI.Components
             base.Dispose(type);
         }
 
-        /// <summary>
-        /// OnInitialize
-        /// </summary>
+        /// <inheritdoc/>
         public override void OnInitialize()
         {
             base.OnInitialize();
+
+            LeaveRequired = true;
+            StateFocusableOnTouchMode = false;
+            EnableControlState = true;
         }
 
         /// <summary>
@@ -312,14 +308,5 @@ namespace Tizen.NUI.Components
             // If the OnThemeChangedEvent is not implemented, ApplyStyle()
             base.OnThemeChanged(sender, e);
         }
-
-        private void Initialize()
-        {
-            LeaveRequired = true;
-
-            StateFocusableOnTouchMode = false;
-
-            EnableControlState = true;
-        }
     }
 }
index ee3f35d..c92587d 100755 (executable)
@@ -657,11 +657,11 @@ namespace Tizen.NUI.Components
             }
             if (mScrollBar.Direction == ScrollBar.DirectionType.Vertical)
             {
-                mScrollBar.Style.Thumb.Size = new Size(thickness, length);
+                mScrollBar.ThumbSize = new Size(thickness, length);
             }
             else
             {
-                mScrollBar.Style.Thumb.Size = new Size(length, thickness);
+                mScrollBar.ThumbSize = new Size(length, thickness);
             }
             mScrollBar.MinValue = 0;
             mScrollBar.MaxValue = (int)(range - extent);
index c019dc4..7966172 100755 (executable)
@@ -39,14 +39,14 @@ namespace Tizen.NUI.Components
             var instance = (ScrollBar)bindable;
             if (newValue != null)
             {
-                instance.Style.Direction = (DirectionType?)newValue;
+                instance.direction = (DirectionType)newValue;
                 instance.UpdateValue();
             }
         },
         defaultValueCreator: (bindable) =>
         {
             var instance = (ScrollBar)bindable;
-            return instance.Style.Direction;
+            return instance.direction;
         });
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -112,7 +112,7 @@ namespace Tizen.NUI.Components
             var instance = (ScrollBar)bindable;
             if (newValue != null)
             {
-                instance.Style.Duration = (uint)newValue;
+                instance.duration = (uint)newValue;
                 if (instance.scrollAniPlayer != null)
                 {
                     instance.scrollAniPlayer.Duration = (int)(uint)newValue;
@@ -122,7 +122,7 @@ namespace Tizen.NUI.Components
         defaultValueCreator: (bindable) =>
         {
             var instance = (ScrollBar)bindable;
-            return instance.Style.Duration;
+            return instance.duration;
         });
 
         private ImageView trackImage;
@@ -134,6 +134,8 @@ namespace Tizen.NUI.Components
         private int minValue;
         private int maxValue;
         private int curValue;
+        private DirectionType direction = DirectionType.Horizontal;
+        private uint duration;
         static ScrollBar() { }
 
         /// <summary>
@@ -144,7 +146,6 @@ namespace Tizen.NUI.Components
         [Obsolete("Deprecated in API8; Will be removed in API10")]
         public ScrollBar() : base()
         {
-            Initialize();
         }
 
         /// <summary>
@@ -154,7 +155,6 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public ScrollBar(string style) : base(style)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -164,7 +164,6 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public ScrollBar(ScrollBarStyle scrollBarStyle) : base(scrollBarStyle)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -194,12 +193,6 @@ namespace Tizen.NUI.Components
 
         #region public property 
         /// <summary>
-        /// Get style of scrollbar.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public new ScrollBarStyle Style => ViewStyle as ScrollBarStyle;
-
-        /// <summary>
         /// The property to get/set the direction of the ScrollBar.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
@@ -241,13 +234,13 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return Style?.Thumb?.Size;
+                return thumbImage?.Size;
             }
             set
             {
-                if (null != Style?.Thumb)
+                if (thumbImage != null)
                 {
-                    Style.Thumb.Size = value;
+                    thumbImage.Size = value;
                     RelayoutRequest();
                 }
             }
@@ -263,13 +256,13 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return Style?.Track?.ResourceUrl?.All;
+                return trackImage?.ResourceUrl;
             }
             set
             {
-                if (null != Style?.Track)
+                if (trackImage != null)
                 {
-                    Style.Track.ResourceUrl = value;
+                    trackImage.ResourceUrl = value;
                     RelayoutRequest();
                 }
             }
@@ -285,14 +278,13 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return Style?.Track?.BackgroundColor?.All;
+                return trackImage?.BackgroundColor;
             }
             set
             {
-                if (null != Style?.Track)
+                if (trackImage != null)
                 {
-                    Style.Track.BackgroundColor = value;
-                    RelayoutRequest();
+                    trackImage.BackgroundColor = value;
                 }
             }
         }
@@ -307,14 +299,13 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return Style?.Thumb?.BackgroundColor?.All;
+                return thumbImage?.BackgroundColor;
             }
             set
             {
-                if (null != Style?.Thumb)
+                if (thumbImage != null)
                 {
-                    Style.Thumb.BackgroundColor = value;
-                    RelayoutRequest();
+                    thumbImage.BackgroundColor = value;
                 }
             }
         }
@@ -499,8 +490,12 @@ namespace Tizen.NUI.Components
             return new ScrollBarStyle();
         }
 
-        private void Initialize()
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnInitialize()
         {
+            base.OnInitialize();
+
             this.Focusable = false;
 
             trackImage = new ImageView
@@ -513,7 +508,7 @@ namespace Tizen.NUI.Components
                 PivotPoint = Tizen.NUI.PivotPoint.CenterLeft
             };
             this.Add(trackImage);
-            trackImage.ApplyStyle(Style.Track);
+            
 
             thumbImage = new ImageView
             {
@@ -525,7 +520,7 @@ namespace Tizen.NUI.Components
                 PivotPoint = Tizen.NUI.PivotPoint.CenterLeft
             };
             this.Add(thumbImage);
-            thumbImage.ApplyStyle(Style.Thumb);
+            
 
             scrollAniPlayer = new Animation(334);
             scrollAniPlayer.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear);
@@ -535,6 +530,20 @@ namespace Tizen.NUI.Components
             LayoutDirectionChanged += OnLayoutDirectionChanged;
         }
 
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void ApplyStyle(ViewStyle style)
+        {
+            base.ApplyStyle(style);
+
+            if (style is ScrollBarStyle scrollBarStyle)
+            {
+                trackImage.ApplyStyle(scrollBarStyle.Track);
+                thumbImage.ApplyStyle(scrollBarStyle.Thumb);
+                UpdateValue();
+            }
+        }
+
         private void OnLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e)
         {
             RelayoutRequest();
@@ -548,18 +557,18 @@ namespace Tizen.NUI.Components
             float height = (float)Size2D.Height;
             float thumbW = 0.0f;
             float thumbH = 0.0f;
-            if (Style.Thumb.Size == null)
+            if (thumbImage == null || thumbImage.Size == null)
             {
                 return;
             }
             else
             {
-                thumbW = Style.Thumb.Size.Width;
-                thumbH = Style.Thumb.Size.Height;
+                thumbW = thumbImage.Size.Width;
+                thumbH = thumbImage.Size.Height;
             }
             float ratio = (float)(curValue - minValue) / (float)(maxValue - minValue);
 
-            if (Style.Direction == DirectionType.Horizontal)
+            if (direction == DirectionType.Horizontal)
             {
                 if (LayoutDirection == ViewLayoutDirectionType.RTL)
                 {
@@ -618,16 +627,6 @@ namespace Tizen.NUI.Components
             if (enableAni) enableAni = false;
         }
 
-        private DirectionType CurrentDirection()
-        {
-            DirectionType dir = DirectionType.Horizontal;
-            if (null != Style.Direction)
-            {
-                dir = Style.Direction.Value;
-            }
-            return dir;
-        }
-
         private int CalculateCurrentValue(float offset, DirectionType dir)
         {
             if (dir == DirectionType.Horizontal)
index 7b22f2b..95e65f6 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
  * limitations under the License.
  *
  */
-using System;
+
 using System.Collections.Generic;
 using System.ComponentModel;
+using System.Diagnostics;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Binding;
 using Tizen.NUI.Accessibility;
@@ -29,78 +30,55 @@ namespace Tizen.NUI.Components
     /// <since_tizen> 6 </since_tizen>
     public class Loading : Control
     {
-        /// <summary>The ImageArray bindable property.</summary>
+        /// <summary>The ImageList bindable property.</summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty ImageArrayProperty = BindableProperty.Create(nameof(ImageArray), typeof(string[]), typeof(Loading), null, propertyChanged: (bindable, oldValue, newValue) =>
+        public static readonly BindableProperty ImageListProperty = BindableProperty.Create(nameof(ImageList), typeof(IList<string>), typeof(Loading), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
-            var instance = (Loading)bindable;
-            if (newValue != null)
-            {
-                instance.loadingStyle.Images = (string[])newValue;
-                instance.imageVisual.URLS = instance.loadingStyle.ImageList as List<string>;
-            }
+            Debug.Assert(((Loading)bindable).imageVisual != null);
+
+            var newList = newValue as List<string>;
+            ((Loading)bindable).imageVisual.URLS = newList == null ? new List<string>() : newList;
         },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (Loading)bindable;
-            return instance.loadingStyle.Images;
+            Debug.Assert(((Loading)bindable).imageVisual != null);
+            return ((Loading)bindable).imageVisual.URLS;
         });
-        /// <summary>The ImageList bindable property.</summary>
+        /// <summary>The Size bindable property.</summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty ImageListProperty = BindableProperty.Create(nameof(ImageList), typeof(IList<string>), typeof(Loading), null, propertyChanged: (bindable, oldValue, newValue) =>
+        public new static readonly BindableProperty SizeProperty = BindableProperty.Create(nameof(Size), typeof(Size), typeof(Loading), new Size(0, 0), propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (Loading)bindable;
             if (newValue != null)
             {
-                var newValueList = newValue as List<string>;
-                instance.loadingStyle.ImageList = newValueList;
-                if (instance.imageVisual != null) instance.imageVisual.URLS = newValueList;
+                Size size = (Size)newValue;
+                ((View)bindable).Size = size;
             }
         },
         defaultValueCreator: (bindable) =>
         {
-            return ((Loading)bindable).loadingStyle.ImageList;
-        });
-        /// <summary>The Size bindable property.</summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public new static readonly BindableProperty SizeProperty = BindableProperty.Create(nameof(Size), typeof(Size), typeof(Loading), new Size(0, 0), propertyChanged: (bindable, oldValue, newValue) =>
-         {
-             var instance = (Loading)bindable;
-             if (newValue != null)
-             {
-                 Size size = (Size)newValue;
-                 ((View)bindable).Size = size;
-                 instance.loadingStyle.LoadingSize = size;
-             }
-         },
-        defaultValueCreator: (bindable) =>
-        {
             var instance = (View)bindable;
             return instance.Size;
         });
         /// <summary>The FrameRate bindable property.</summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty FrameRateProperty = BindableProperty.Create(nameof(FrameRate), typeof(int), typeof(Loading), (int)(1000 / 16.6f), propertyChanged: (bindable, oldValue, newValue) =>
-          {
-              var instance = (Loading)bindable;
-              if (newValue != null)
-              {
-                  int frameRate = (int)newValue;
-                  if (0 != frameRate) //It will crash if 0
-                  {
-                      instance.loadingStyle.FrameRate = frameRate;
-                      instance.imageVisual.FrameDelay = 1000.0f / frameRate;
-                  }
-              }
-          },
+        {
+            Debug.Assert(((Loading)bindable).imageVisual != null);
+
+            int frameRate = (int)newValue;
+            if (0 != frameRate) //It will crash if 0
+            {
+                ((Loading)bindable).imageVisual.FrameDelay = 1000.0f / frameRate;
+            }
+        },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (Loading)bindable;
-            return instance.loadingStyle.FrameRate?.All ?? (int)(1000 / 16.6f);
+            Debug.Assert(((Loading)bindable).imageVisual != null);
+            return ((Loading)bindable).imageVisual.FrameDelay * 1000.0f;
         });
 
         private AnimatedImageVisual imageVisual = null;
-        private LoadingStyle loadingStyle => ViewStyle as LoadingStyle;
 
         internal new class Property
         {
@@ -117,7 +95,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public Loading() : base()
         {
-            Initialize();
         }
 
         /// <summary>
@@ -127,7 +104,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Loading(string style) : base(style)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -137,27 +113,16 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Loading(LoadingStyle loadingStyle) : base(loadingStyle)
         {
-            Initialize();
         }
 
         /// <summary>
-        /// Get style of loading.
-        /// Return a copied Style instance of Loading
+        /// Return currently applied style.
         /// </summary>
         /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the Loading.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
-        /// </remarks>>
+        /// Modifying contents in style may cause unexpected behaviour.
+        /// </remarks>
         /// <since_tizen> 8 </since_tizen>
-        public new LoadingStyle Style
-        {
-            get
-            {
-                var result = new LoadingStyle(loadingStyle);
-                result.CopyPropertiesFromView(this);
-                return result;
-            }
-        }
+        public LoadingStyle Style => (LoadingStyle)(ViewStyle as LoadingStyle)?.Clone();
 
         /// <summary>
         /// Gets or sets loading image resource array.
@@ -165,14 +130,8 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public string[] ImageArray
         {
-            get
-            {
-                return (string[])GetValue(ImageArrayProperty);
-            }
-            set
-            {
-                SetValue(ImageArrayProperty, value);
-            }
+            get => (GetValue(ImageListProperty) as List<string>).ToArray();
+            set => SetValue(ImageListProperty, value == null ? new List<string>() : new List<string>((string[])value));
         }
 
         /// <summary>
@@ -219,6 +178,51 @@ namespace Tizen.NUI.Components
             }
         }
 
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnInitialize()
+        {
+            base.OnInitialize();
+
+            imageVisual = new AnimatedImageVisual()
+            {
+                URLS = new List<string>(),
+                FrameDelay = 16.6f,
+                LoopCount = -1,
+                Position = new Vector2(0, 0),
+                Origin = Visual.AlignType.Center,
+                AnchorPoint = Visual.AlignType.Center,
+                SizePolicy = VisualTransformPolicyType.Relative,
+                Size = new Size2D(1, 1)
+            };
+
+            this.AddVisual("loadingImageVisual", imageVisual);
+
+            AccessibilityManager.Instance.SetAccessibilityAttribute(this, AccessibilityManager.AccessibilityAttribute.Trait, "Loading");
+        }
+
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void ApplyStyle(ViewStyle viewStyle)
+        {
+            base.ApplyStyle(viewStyle);
+
+            Debug.Assert(imageVisual != null);
+
+            if (viewStyle is LoadingStyle loadingStyle)
+            {
+                if (loadingStyle.Images != null)
+                {
+                    imageVisual.URLS = loadingStyle.ImageList as List<string>;
+                }
+
+                if (loadingStyle.LoadingSize != null)
+                {
+                    Size = loadingStyle.LoadingSize;
+                }
+            }
+        }
+
         /// <summary>
         /// Get Loading style.
         /// </summary>
@@ -253,40 +257,6 @@ namespace Tizen.NUI.Components
             base.Dispose(type);
         }
 
-        private void Initialize()
-        {
-            imageVisual = new AnimatedImageVisual()
-            {
-                URLS = new List<string>(),
-                FrameDelay = 16.6f,
-                LoopCount = -1,
-                Position = new Vector2(0, 0),
-                Origin = Visual.AlignType.Center,
-                AnchorPoint = Visual.AlignType.Center,
-                SizePolicy = VisualTransformPolicyType.Relative,
-                Size = new Size2D(1, 1)
-            };
-
-            UpdateVisual();
-
-            this.AddVisual("loadingImageVisual", imageVisual);
-
-            AccessibilityManager.Instance.SetAccessibilityAttribute(this, AccessibilityManager.AccessibilityAttribute.Trait, "Loading");
-        }
-
-        private void UpdateVisual()
-        {
-            if (null != loadingStyle.Images)
-            {
-                loadingStyle.ImageList = new List<string>(loadingStyle.Images);
-                imageVisual.URLS = loadingStyle.ImageList as List<string>;
-            }
-            if (null != loadingStyle.FrameRate?.All && 0 != loadingStyle.FrameRate.All.Value)
-            {
-                imageVisual.FrameDelay = 1000.0f / (float)loadingStyle.FrameRate.All.Value;
-            }
-        }
-
         /// <summary>
         /// Play Loading Animation.
         /// </summary>
index f42a2f4..b537fb8 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
  * limitations under the License.
  *
  */
+
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
+using System.Diagnostics;
 using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
 
 namespace Tizen.NUI.Components
 {
@@ -27,13 +30,57 @@ namespace Tizen.NUI.Components
     /// <since_tizen> 8 </since_tizen>
     public class Pagination : Control
     {
-        private VisualView container;
+        /// <summary>The IndicatorSize bindable property.</summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty IndicatorSizeProperty = BindableProperty.Create(nameof(IndicatorSize), typeof(Size), typeof(Pagination), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            if (newValue != null)
+            {
+                var pagination = (Pagination)bindable;
+                pagination.indicatorSize = new Size((Size)newValue);
+                pagination.UpdateVisual();
+                pagination.UpdateContainer();
+            }
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            return ((Pagination)bindable).indicatorSize;
+        });
 
+        /// <summary>The IndicatorImageUrlSelector bindable property.</summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty IndicatorImageUrlProperty = BindableProperty.Create("IndicatorImageUrl", typeof(Selector<string>), typeof(Pagination), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var pagination = (Pagination)bindable;
+            pagination.indicatorImageUrl = ((Selector<string>)newValue)?.Clone();
+            pagination.UpdateVisual();
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            return ((Pagination)bindable).indicatorImageUrl;
+        });
+
+        /// <summary>The IndicatorSpacing bindable property.</summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty IndicatorSpacingProperty = BindableProperty.Create(nameof(IndicatorSpacing), typeof(int), typeof(Pagination), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var pagination = (Pagination)bindable;
+            pagination.indicatorSpacing = (int)newValue;
+            pagination.UpdateVisual();
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            return ((Pagination)bindable).indicatorSpacing;
+        });
+
+        private VisualView container;
+        private Size indicatorSize = new Size(10, 10);
+        private Selector<string> indicatorImageUrl;
+        private int indicatorSpacing;
         private List<ImageVisual> indicatorList = new List<ImageVisual>();
 
         private int indicatorCount = 0;
-        private int selectedIndex = -1;
-        private PaginationStyle paginationStyle => ViewStyle as PaginationStyle;
+        private int selectedIndex = 0;
 
         private Color indicatorColor;
         private Color selectedIndicatorColor;
@@ -47,7 +94,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Pagination() : base()
         {
-            Initialize();
         }
 
         /// <summary>
@@ -57,7 +103,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Pagination(string style) : base(style)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -67,23 +112,16 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Pagination(PaginationStyle paginationStyle) : base(paginationStyle)
         {
-            Initialize();
         }
 
         /// <summary>
-        /// Get style of pagination.
+        /// Return currently applied style.
         /// </summary>
-        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <remarks>
+        /// Modifying contents in style may cause unexpected behaviour.
+        /// </remarks>
         /// <since_tizen> 8 </since_tizen>
-        public new PaginationStyle Style
-        {
-            get
-            {
-                var result = new PaginationStyle(paginationStyle);
-                result.CopyPropertiesFromView(this);
-                return result;
-            }
-        }
+        public PaginationStyle Style => (PaginationStyle)(ViewStyle as PaginationStyle)?.Clone();
 
         /// <summary>
         /// Gets or sets the size of the indicator.
@@ -91,20 +129,8 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Size IndicatorSize
         {
-            get
-            {
-                return paginationStyle?.IndicatorSize;
-            }
-            set
-            {
-                if (value == null || paginationStyle == null)
-                {
-                    return;
-                }
-                paginationStyle.IndicatorSize = value;
-                UpdateVisual();
-                UpdateContainer();
-            }
+            get => (Size)GetValue(IndicatorSizeProperty);
+            set => SetValue(IndicatorSizeProperty, value);
         }
 
         /// <summary>
@@ -113,19 +139,8 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Selector<string> IndicatorImageUrl
         {
-            get
-            {
-                return paginationStyle?.IndicatorImageUrl;
-            }
-            set
-            {
-                if (value == null || paginationStyle == null)
-                {
-                    return;
-                }
-                paginationStyle.IndicatorImageUrl = value;
-                UpdateVisual();
-            }
+            get => (Selector<string>)GetValue(IndicatorImageUrlProperty);
+            set => SetValue(IndicatorImageUrlProperty, value);
         }
 
         /// <summary>
@@ -152,18 +167,8 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public int IndicatorSpacing
         {
-            get
-            {
-                return (int)paginationStyle?.IndicatorSpacing;
-            }
-            set
-            {
-                if (paginationStyle != null)
-                {
-                    paginationStyle.IndicatorSpacing = value;
-                    UpdateVisual();
-                }
-            }
+            get => (int)GetValue(IndicatorSpacingProperty);
+            set => SetValue(IndicatorSpacingProperty, value);
         }
 
 
@@ -179,7 +184,7 @@ namespace Tizen.NUI.Components
             }
             set
             {
-                if (indicatorCount == value || indicatorCount < 0)
+                if (indicatorCount == value || value < 0)
                 {
                     return;
                 }
@@ -191,7 +196,7 @@ namespace Tizen.NUI.Components
                     prevLastIndex = LastIndicatorIndex;
                     for (int i = indicatorCount; i < value; i++)
                     {
-                        CreateIndicator();
+                        CreateIndicator(i);
                     }
                 }
                 else
@@ -205,17 +210,21 @@ namespace Tizen.NUI.Components
 
                     if (selectedIndex >= value)
                     {
-                        selectedIndex = 0;
-                        SelectIn(indicatorList[selectedIndex]);
+                        selectedIndex = Math.Max(0, value - 1);
+
+                        if (value > 0)
+                        {
+                            SelectIn(indicatorList[selectedIndex]);
+                        }
                     }
                 }
                 indicatorCount = value;
 
-                if (lastIndicatorImageUrl != null && paginationStyle != null && indicatorCount > 0)
+                if (lastIndicatorImageUrl != null && indicatorImageUrl != null && indicatorCount > 0)
                 {
-                    if (prevLastIndex >= 0 && paginationStyle.IndicatorImageUrl != null)
+                    if (prevLastIndex >= 0)
                     {
-                        indicatorList[prevLastIndex].URL = prevLastIndex == selectedIndex ? paginationStyle.IndicatorImageUrl.Selected : paginationStyle.IndicatorImageUrl.Normal;
+                        indicatorList[prevLastIndex].URL = prevLastIndex == selectedIndex ? indicatorImageUrl.Selected : indicatorImageUrl.Normal;
                     }
                     indicatorList[LastIndicatorIndex].URL = IsLastSelected ? lastIndicatorImageUrl.Selected : lastIndicatorImageUrl.Normal;
                 }
@@ -338,19 +347,21 @@ namespace Tizen.NUI.Components
             }
             set
             {
-                if (selectedIndex == value)
+                var refinedValue = Math.Max(0, Math.Min(value, indicatorCount - 1));
+
+                if (selectedIndex == refinedValue)
                 {
                     return;
                 }
-                if (selectedIndex >= 0 && selectedIndex < indicatorCount)
-                {
-                    SelectOut(indicatorList[selectedIndex]);
-                }
-                selectedIndex = value;
-                if (selectedIndex >= 0 && selectedIndex < indicatorCount)
-                {
-                    SelectIn(indicatorList[selectedIndex]);
-                }
+
+                Debug.Assert(refinedValue >= 0 && refinedValue < indicatorCount);
+                Debug.Assert(selectedIndex >= 0 && selectedIndex < indicatorCount);
+
+                SelectOut(indicatorList[selectedIndex]);
+
+                selectedIndex = refinedValue;
+
+                SelectIn(indicatorList[selectedIndex]);
             }
         }
 
@@ -369,6 +380,26 @@ namespace Tizen.NUI.Components
             return new Position(indicatorList[index].Position.X + container.PositionX, indicatorList[index].Position.Y + container.PositionY);
         }
 
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnInitialize()
+        {
+            base.OnInitialize();
+
+            container = new VisualView()
+            {
+                Name = "Container",
+                ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft,
+                PivotPoint = Tizen.NUI.PivotPoint.CenterLeft,
+                PositionUsesPivotPoint = true,
+            };
+            this.Add(container);
+
+            //TODO: Apply color properties from PaginationStyle class.
+            indicatorColor = new Color(1.0f, 1.0f, 1.0f, 0.5f);
+            selectedIndicatorColor = new Color(1.0f, 1.0f, 1.0f, 1.0f);
+        }
+
         /// <summary>
         /// You can override it to do your select out operation.
         /// </summary>
@@ -377,7 +408,7 @@ namespace Tizen.NUI.Components
         protected virtual void SelectOut(VisualMap selectOutIndicator)
         {
             if (!(selectOutIndicator is ImageVisual visual)) return;
-            visual.URL = ((IsLastSelected && lastIndicatorImageUrl != null) ? lastIndicatorImageUrl : paginationStyle?.IndicatorImageUrl)?.Normal;
+            visual.URL = ((IsLastSelected && lastIndicatorImageUrl != null) ? lastIndicatorImageUrl : indicatorImageUrl)?.Normal;
 
             if (indicatorColor == null)
             {
@@ -400,7 +431,7 @@ namespace Tizen.NUI.Components
         protected virtual void SelectIn(VisualMap selectInIndicator)
         {
             if (!(selectInIndicator is ImageVisual visual)) return;
-            visual.URL = ((IsLastSelected && lastIndicatorImageUrl != null) ? lastIndicatorImageUrl : paginationStyle?.IndicatorImageUrl)?.Selected;
+            visual.URL = ((IsLastSelected && lastIndicatorImageUrl != null) ? lastIndicatorImageUrl : indicatorImageUrl)?.Selected;
 
             if (selectedIndicatorColor == null)
             {
@@ -450,75 +481,59 @@ namespace Tizen.NUI.Components
             base.Dispose(type);
         }
 
-        private void Initialize()
+        private void CreateIndicator(int index)
         {
-            container = new VisualView()
-            {
-                Name = "Container",
-                ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft,
-                PivotPoint = Tizen.NUI.PivotPoint.CenterLeft,
-                PositionUsesPivotPoint = true,
-            };
-            this.Add(container);
+            Debug.Assert(indicatorSize != null);
 
-            //TODO: Apply color properties from PaginationStyle class.
-            indicatorColor = new Color(1.0f, 1.0f, 1.0f, 0.5f);
-            selectedIndicatorColor = new Color(1.0f, 1.0f, 1.0f, 1.0f);
-        }
-
-        private void CreateIndicator()
-        {
-            if (paginationStyle == null)
-            {
-                return;
-            }
-            if (paginationStyle.IndicatorSize == null)
-            {
-                paginationStyle.IndicatorSize = new Size(0, 0);
-            }
             ImageVisual indicator = new ImageVisual
             {
-                URL = paginationStyle.IndicatorImageUrl?.Normal,
-                Size = new Size2D((int)paginationStyle.IndicatorSize.Width, (int)paginationStyle.IndicatorSize.Height),
+                URL = indicatorImageUrl?.Normal,
+                Size = indicatorSize,
                 //TODO: Apply color properties from PaginationStyle class.
                 MixColor = (indicatorColor == null) ? new Color(1.0f, 1.0f, 1.0f, 0.5f) : indicatorColor,
                 Opacity = (indicatorColor == null) ? 0.5f : indicatorColor.A
             };
-            indicator.Position = new Vector2((int)(paginationStyle.IndicatorSize.Width + paginationStyle.IndicatorSpacing) * indicatorList.Count, 0);
+            indicator.Position = new Vector2((int)(indicatorSize.Width + indicatorSpacing) * indicatorList.Count, 0);
             container.AddVisual("Indicator" + indicatorList.Count, indicator);
             indicatorList.Add(indicator);
+
+            if (index == selectedIndex)
+            {
+                SelectIn(indicatorList[selectedIndex]);
+            }
         }
 
         private void UpdateContainer()
         {
-            if (paginationStyle == null)
-            {
-                return;
-            }
+            Debug.Assert(indicatorSize != null);
+
             if (indicatorList.Count > 0)
             {
-                container.SizeWidth = (paginationStyle.IndicatorSize.Width + paginationStyle.IndicatorSpacing) * indicatorList.Count - paginationStyle.IndicatorSpacing;
+                container.SizeWidth = (indicatorSize.Width + indicatorSpacing) * indicatorList.Count - indicatorSpacing;
             }
             else
             {
                 container.SizeWidth = 0;
             }
-            container.SizeHeight = paginationStyle.IndicatorSize.Height;
+            container.SizeHeight = indicatorSize.Height;
             container.PositionX = (int)((this.SizeWidth - container.SizeWidth) / 2);
         }
 
         private void UpdateVisual()
         {
-            if (null == paginationStyle?.IndicatorSize) return;
-            if (null == paginationStyle?.IndicatorImageUrl) return;
-            if (indicatorCount < 0) return;
+            Debug.Assert(indicatorSize != null);
+
+            if (indicatorImageUrl == null)
+            {
+                return;
+            }
 
             for (int i = 0; i < indicatorList.Count; i++)
             {
                 ImageVisual indicator = indicatorList[i];
-                indicator.URL = paginationStyle.IndicatorImageUrl?.Normal;
-                indicator.Size = new Size2D((int)paginationStyle.IndicatorSize.Width, (int)paginationStyle.IndicatorSize.Height);
-                indicator.Position = new Vector2((int)(paginationStyle.IndicatorSize.Width + paginationStyle.IndicatorSpacing) * i, 0);
+                indicator.URL = indicatorImageUrl?.Normal;
+                indicator.Size = indicatorSize;
+                indicator.Position = new Vector2((int)(indicatorSize.Width + indicatorSpacing) * i, 0);
             }
 
             if (lastIndicatorImageUrl != null && indicatorCount > 0)
index e806c57..abe649c 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
@@ -35,17 +35,15 @@ namespace Tizen.NUI.Components
         public static readonly BindableProperty ButtonHeightProperty = BindableProperty.Create(nameof(ButtonHeight), typeof(int), typeof(Popup), default(int), propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (Popup)bindable;
-            if (newValue != null && instance?.popupStyle?.Buttons?.Size != null)
+            if (newValue != null)
             {
-                instance.popupStyle.Buttons.SizeHeight = (int)newValue;
                 instance.btGroup.Itemheight = (int)newValue;
                 instance.UpdateView();
             }
         },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (Popup)bindable;
-            return (int)(instance.popupStyle?.Buttons?.Size?.Height ?? 0);
+            return (int)((Popup)bindable).btGroup.Itemheight;
         });
 
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -55,17 +53,12 @@ namespace Tizen.NUI.Components
             var instance = (Popup)bindable;
             if (newValue != null)
             {
-                if (instance.popupStyle?.Buttons?.Text != null)
-                {
-                    instance.popupStyle.Buttons.Text.PointSize = (float)newValue;
-                }
                 instance.btGroup.ItemPointSize = (float)newValue;
             }
         },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (Popup)bindable;
-            return instance.popupStyle?.Buttons?.Text?.PointSize?.All ?? 0;
+            return ((Popup)bindable).btGroup.ItemPointSize;
         });
 
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -75,14 +68,12 @@ namespace Tizen.NUI.Components
             var instance = (Popup)bindable;
             if (newValue != null)
             {
-                instance.popupStyle.Buttons.Text.FontFamily = (string)newValue;
                 instance.btGroup.ItemFontFamily = (string)newValue;
             }
         },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (Popup)bindable;
-            return instance.popupStyle?.Buttons?.Text?.FontFamily.All;
+            return ((Popup)bindable).btGroup.ItemFontFamily;
         });
 
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -92,17 +83,12 @@ namespace Tizen.NUI.Components
             var instance = (Popup)bindable;
             if (newValue != null)
             {
-                if (instance.popupStyle?.Buttons?.Text != null)
-                {
-                    instance.popupStyle.Buttons.Text.TextColor = (Color)newValue;
-                }
                 instance.btGroup.ItemTextColor = (Color)newValue;
             }
         },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (Popup)bindable;
-            return instance.popupStyle?.Buttons?.Text?.TextColor?.All;
+            return ((Popup)bindable).btGroup.ItemTextColor;
         });
 
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -112,14 +98,12 @@ namespace Tizen.NUI.Components
             var instance = (Popup)bindable;
             if (newValue != null)
             {
-                instance.popupStyle.Buttons.Overlay.BackgroundColor = (Selector<Color>)newValue;
                 instance.btGroup.OverLayBackgroundColorSelector = (Selector<Color>)newValue;
             }
         },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (Popup)bindable;
-            return instance.popupStyle?.Buttons?.Overlay?.BackgroundColor;
+            return ((Popup)bindable).btGroup.OverLayBackgroundColorSelector;
         });
 
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -129,14 +113,12 @@ namespace Tizen.NUI.Components
             var instance = (Popup)bindable;
             if (newValue != null)
             {
-                instance.popupStyle.Buttons.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
                 instance.btGroup.ItemTextAlignment = (HorizontalAlignment)newValue;
             }
         },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (Popup)bindable;
-            return instance.popupStyle?.Buttons?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
+            return ((Popup)bindable).btGroup.ItemTextAlignment;
         });
 
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -146,19 +128,12 @@ namespace Tizen.NUI.Components
             var instance = (Popup)bindable;
             if (newValue != null)
             {
-                if (instance.popupStyle.Buttons.BackgroundImage == null)
-                {
-                    instance.popupStyle.Buttons.BackgroundImage = new Selector<string>();
-                }
-                instance.popupStyle.Buttons.BackgroundColor = new Selector<Color>();
-                instance.popupStyle.Buttons.BackgroundImage = (string)newValue;
                 instance.btGroup.ItemBackgroundImageUrl = (string)newValue;
             }
         },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (Popup)bindable;
-            return instance.popupStyle?.Buttons?.BackgroundImage?.All;
+            return ((Popup)bindable).btGroup.ItemBackgroundImageUrl;
         });
 
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -168,18 +143,12 @@ namespace Tizen.NUI.Components
             var instance = (Popup)bindable;
             if (newValue != null)
             {
-                if (instance.popupStyle.Buttons.BackgroundImageBorder == null)
-                {
-                    instance.popupStyle.Buttons.BackgroundImageBorder = new Selector<Rectangle>();
-                }
-                instance.popupStyle.Buttons.BackgroundImageBorder = (Rectangle)newValue;
                 instance.btGroup.ItemBackgroundBorder = (Rectangle)newValue;
             }
         },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (Popup)bindable;
-            return instance.popupStyle?.Buttons?.BackgroundImageBorder?.All;
+            return ((Popup)bindable).btGroup.ItemBackgroundBorder;
         });
 
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -189,20 +158,18 @@ namespace Tizen.NUI.Components
             var instance = (Popup)bindable;
             ImageShadow shadow = (ImageShadow)newValue;
             instance.btGroup.ItemImageShadow = new ImageShadow(shadow);
-            instance.popupStyle.Buttons.ImageShadow = new ImageShadow(shadow);
         },
         defaultValueCreator: (bindable) =>
         {
-            var instance = (Popup)bindable;
-            return instance.popupStyle?.Buttons?.ImageShadow?.All;
+            return ((Popup)bindable).btGroup.ItemImageShadow;
         });
 
-
-        private PopupStyle popupStyle => ViewStyle as PopupStyle;
         private TextLabel titleText;
         private ButtonGroup btGroup = null;
         private Window window = null;
         private Layer container = new Layer();
+        private ButtonStyle buttonStyle = new ButtonStyle();
+
         static Popup() { }
 
         /// <summary>
@@ -212,7 +179,6 @@ namespace Tizen.NUI.Components
         [Obsolete("Deprecated in API8; Will be removed in API10")]
         public Popup() : base()
         {
-            Initialize();
         }
 
         /// <summary>
@@ -222,7 +188,6 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public Popup(string style) : base(style)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -232,7 +197,6 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public Popup(PopupStyle popupStyle) : base(popupStyle)
         {
-            Initialize();
         }
 
         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -268,14 +232,11 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public void AddButton(string buttonText)
         {
-            if (popupStyle.Buttons != null)
-            {
-                Button btn = new Button(popupStyle.Buttons);
-                btn.Text = buttonText;
-                btn.ClickEvent += ButtonClickEvent;
-                btGroup.AddItem(btn);
-                UpdateView();
-            }
+            Button btn = new Button(buttonStyle);
+            btn.Text = buttonText;
+            btn.ClickEvent += ButtonClickEvent;
+            btGroup.AddItem(btn);
+            UpdateView();
         }
 
         /// <summary>
@@ -293,11 +254,11 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public void AddButton(string buttonText, ButtonStyle style)
         {
-            if (popupStyle.Buttons != null && style != null)
-            {
-                popupStyle.Buttons.CopyFrom(style);
-                AddButton(buttonText);
-            }
+            Button btn = new Button(style);
+            btn.Text = buttonText;
+            btn.ClickEvent += ButtonClickEvent;
+            btGroup.AddItem(btn);
+            UpdateView();
         }
 
         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -333,21 +294,6 @@ namespace Tizen.NUI.Components
         public event EventHandler<ButtonClickEventArgs> PopupButtonClickEvent;
 
         /// <summary>
-        /// Get style of popup.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public new PopupStyle Style
-        {
-            get
-            {
-                var result = new PopupStyle(popupStyle);
-                result.CopyPropertiesFromView(this);
-                result.Title.CopyPropertiesFromView(titleText);
-                return result;
-            }
-        }
-
-        /// <summary>
         /// Popup Title.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -383,20 +329,8 @@ namespace Tizen.NUI.Components
         [Obsolete("Deprecated in API8; Will be removed in API10")]
         public string TitleText
         {
-            get
-            {
-                return popupStyle?.Title?.Text?.All;
-            }
-            set
-            {
-                if (value != null)
-                {
-                    if (popupStyle?.Title != null)
-                    {
-                        popupStyle.Title.Text = value;
-                    }
-                }
-            }
+            get => Title.Text;
+            set => Title.Text = value;
         }
 
         /// <summary>
@@ -406,17 +340,8 @@ namespace Tizen.NUI.Components
         [Obsolete("Deprecated in API8; Will be removed in API10")]
         public float TitlePointSize
         {
-            get
-            {
-                return popupStyle?.Title?.PointSize?.All ?? 0;
-            }
-            set
-            {
-                if (popupStyle?.Title != null)
-                {
-                    popupStyle.Title.PointSize = value;
-                }
-            }
+            get => Title.PointSize;
+            set => Title.PointSize = value;
         }
 
         /// <summary>
@@ -426,17 +351,8 @@ namespace Tizen.NUI.Components
         [Obsolete("Deprecated in API8; Will be removed in API10")]
         public Color TitleTextColor
         {
-            get
-            {
-                return popupStyle?.Title?.TextColor?.All;
-            }
-            set
-            {
-                if (popupStyle?.Title != null)
-                {
-                    popupStyle.Title.TextColor = value;
-                }
-            }
+            get => Title.TextColor;
+            set => Title.TextColor = value;
         }
 
         /// <summary>
@@ -446,14 +362,8 @@ namespace Tizen.NUI.Components
         [Obsolete("Deprecated in API8; Will be removed in API10")]
         public HorizontalAlignment TitleTextHorizontalAlignment
         {
-            get
-            {
-                return popupStyle?.Title?.HorizontalAlignment ?? HorizontalAlignment.Center;
-            }
-            set
-            {
-                popupStyle.Title.HorizontalAlignment = value;
-            }
+            get => Title.HorizontalAlignment;
+            set => Title.HorizontalAlignment = value;
         }
 
         /// <summary>
@@ -463,14 +373,8 @@ namespace Tizen.NUI.Components
         [Obsolete("Deprecated in API8; Will be removed in API10")]
         public Position TitleTextPosition
         {
-            get
-            {
-                return popupStyle?.Title?.Position ?? new Position(0, 0, 0);
-            }
-            set
-            {
-                popupStyle.Title.Position = value;
-            }
+            get => Title.Position;
+            set => Title.Position = value;
         }
 
         /// <summary>
@@ -480,17 +384,8 @@ namespace Tizen.NUI.Components
         [Obsolete("Deprecated in API8; Will be removed in API10")]
         public int TitleHeight
         {
-            get
-            {
-                return (int)(popupStyle?.Title?.Size?.Height ?? 0);
-            }
-            set
-            {
-                if (popupStyle?.Title?.Size != null)
-                {
-                    popupStyle.Title.SizeHeight = value;
-                }
-            }
+            get => (int)Title.SizeHeight;
+            set => Title.SizeHeight = (int)value;
         }
 
         /// <summary>
@@ -715,6 +610,8 @@ namespace Tizen.NUI.Components
                     btGroup.Dispose();
                     btGroup = null;
                 }
+
+                buttonStyle?.Dispose();
             }
 
             base.Dispose(type);
@@ -753,20 +650,22 @@ namespace Tizen.NUI.Components
 
             if (viewStyle is PopupStyle ppStyle)
             {
-                if (ppStyle.Buttons == null)
+                if (ppStyle.Buttons?.SizeHeight != null)
                 {
-                    ppStyle.Buttons = new ButtonStyle();
+                    ButtonHeight = (int)ppStyle.Buttons.SizeHeight;
                 }
 
-                if (ppStyle.Buttons.PositionUsesPivotPoint == null) ppStyle.Buttons.PositionUsesPivotPoint = true;
-                if (ppStyle.Buttons.ParentOrigin == null) ppStyle.Buttons.ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft;
-                if (ppStyle.Buttons.PivotPoint == null) ppStyle.Buttons.PivotPoint = Tizen.NUI.PivotPoint.BottomLeft;
+                buttonStyle = (ButtonStyle)ppStyle.Buttons?.Clone();
+                if (buttonStyle.PositionUsesPivotPoint == null) buttonStyle.PositionUsesPivotPoint = true;
+                if (buttonStyle.ParentOrigin == null) buttonStyle.ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft;
+                if (buttonStyle.PivotPoint == null) buttonStyle.PivotPoint = Tizen.NUI.PivotPoint.BottomLeft;
 
                 if (btGroup != null)
                 {
                     for (int i = 0; i < btGroup.Count; i++)
                     {
-                        GetButton(i)?.ApplyStyle(ppStyle.Buttons);
+                        var button = GetButton(i);
+                        button.ApplyStyle(buttonStyle);
                     }
                 }
 
@@ -793,8 +692,16 @@ namespace Tizen.NUI.Components
             UpdateView();
         }
 
-        private void Initialize()
+        /// <summary>
+        /// Initialize AT-SPI object.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnInitialize()
         {
+            base.OnInitialize();
+            SetAccessibilityConstructor(Role.Dialog);
+            AppendAccessibilityAttribute("sub-role", "Alert");
+
             container.Add(this);
             container.SetTouchConsumed(true);
             container.SetHoverConsumed(true);
@@ -817,17 +724,6 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// Initialize AT-SPI object.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public override void OnInitialize()
-        {
-            base.OnInitialize();
-            SetAccessibilityConstructor(Role.Dialog);
-            AppendAccessibilityAttribute("sub-role", "Alert");
-        }
-
-        /// <summary>
         /// Informs AT-SPI bridge about the set of AT-SPI states associated with this object.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -840,8 +736,7 @@ namespace Tizen.NUI.Components
 
         private void UpdateView()
         {
-            if (popupStyle == null) return;
-            btGroup.UpdateButton(popupStyle.Buttons);
+            btGroup.UpdateButton(buttonStyle);
             UpdateContentView();
             UpdateTitle();
         }
@@ -867,7 +762,7 @@ namespace Tizen.NUI.Components
         {
             if (e.PropertyName.Equals("LayoutDirection"))
             {
-                btGroup.UpdateButton(popupStyle.Buttons);
+                btGroup.UpdateButton(buttonStyle);
             }
         }
 
@@ -889,9 +784,9 @@ namespace Tizen.NUI.Components
                 titleY = (int)Title.Position.Y;
             }
 
-            if (btGroup.Count != 0 && popupStyle?.Buttons?.Size != null)
+            if (btGroup.Count != 0)
             {
-                buttonH = (int)popupStyle.Buttons.Size.Height;
+                buttonH = ButtonHeight;
             }
             ContentView.Size = new Size(Size.Width - titleX * 2, Size.Height - titleY - titleH - buttonH);
             ContentView.Position = new Position(titleX, titleY + titleH);
@@ -900,7 +795,7 @@ namespace Tizen.NUI.Components
 
         private void UpdateTitle()
         {
-            if (titleText != null && string.IsNullOrEmpty(popupStyle.Title.Text.All) && popupStyle.Title.Size != null)
+            if (titleText != null && string.IsNullOrEmpty(Title.Text) && Title.Size != null)
             {
                 titleText.RaiseToTop();
             }
index 5b18b4a..8c044b2 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
@@ -17,6 +17,7 @@
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Binding;
 using System.ComponentModel;
+using System.Diagnostics;
 
 namespace Tizen.NUI.Components
 {
@@ -130,7 +131,6 @@ namespace Tizen.NUI.Components
         private float minValue = 0;
         private float currentValue = 0;
         private float bufferValue = 0;
-        private ProgressStyle progressStyle => ViewStyle as ProgressStyle;
 
         static Progress() { }
         /// <summary>
@@ -139,7 +139,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public Progress() : base()
         {
-            Initialize();
         }
 
         /// <summary>
@@ -149,7 +148,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Progress(string style) : base(style)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -159,7 +157,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Progress(ProgressStyle progressStyle) : base(progressStyle)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -188,21 +185,13 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// Get style of progress.
+        /// Return currently applied style.
         /// </summary>
+        /// <remarks>
+        /// Modifying contents in style may cause unexpected behaviour.
+        /// </remarks>
         /// <since_tizen> 8 </since_tizen>
-        public new ProgressStyle Style
-        {
-            get
-            {
-                var result = new ProgressStyle(progressStyle);
-                result.CopyPropertiesFromView(this);
-                result.Track.CopyPropertiesFromView(trackImage);
-                result.Progress.CopyPropertiesFromView(progressImage);
-                result.Buffer.CopyPropertiesFromView(bufferImage);
-                return result;
-            }
-        }
+        public ProgressStyle Style => (ProgressStyle)(ViewStyle as ProgressStyle)?.Clone();
 
         /// <summary>
         /// The property to get/set Track image object URL of the Progress.
@@ -210,17 +199,8 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public string TrackImageURL
         {
-            get
-            {
-                return progressStyle?.Track?.ResourceUrl?.All;
-            }
-            set
-            {
-                if (null != progressStyle?.Track)
-                {
-                    progressStyle.Track.ResourceUrl = value;
-                }
-            }
+            get => trackImage.ResourceUrl;
+            set => trackImage.ResourceUrl = value;
         }
 
         /// <summary>
@@ -229,17 +209,8 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public string ProgressImageURL
         {
-            get
-            {
-                return progressStyle?.Progress?.ResourceUrl?.All;
-            }
-            set
-            {
-                if (null != progressStyle?.Progress)
-                {
-                    progressStyle.Progress.ResourceUrl = value;
-                }
-            }
+            get => progressImage.ResourceUrl;
+            set => progressImage.ResourceUrl = value;
         }
 
         /// <summary>
@@ -248,18 +219,8 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public string BufferImageURL
         {
-            get
-            {
-                return progressStyle?.Buffer?.ResourceUrl?.All;
-            }
-            set
-            {
-                if (null != progressStyle?.Buffer)
-                {
-                    progressStyle.Buffer.ResourceUrl = value;
-                    RelayoutRequest();
-                }
-            }
+            get => bufferImage.ResourceUrl;
+            set => bufferImage.ResourceUrl = value;
         }
 
         /// <summary>
@@ -268,17 +229,8 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public Color TrackColor
         {
-            get
-            {
-                return progressStyle?.Track?.BackgroundColor?.All;
-            }
-            set
-            {
-                if (null != progressStyle?.Track)
-                {
-                    progressStyle.Track.BackgroundColor = value;
-                }
-            }
+            get => trackImage.BackgroundColor;
+            set => trackImage.BackgroundColor = value;
         }
 
         /// <summary>
@@ -287,17 +239,8 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public Color ProgressColor
         {
-            get
-            {
-                return progressStyle?.Progress?.BackgroundColor?.All;
-            }
-            set
-            {
-                if (null != progressStyle?.Progress)
-                {
-                    progressStyle.Progress.BackgroundColor = value;
-                }
-            }
+            get => progressImage.BackgroundColor;
+            set => progressImage.BackgroundColor = value;
         }
 
         /// <summary>
@@ -306,17 +249,8 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public Color BufferColor
         {
-            get
-            {
-                return progressStyle?.Buffer?.BackgroundColor?.All;
-            }
-            set
-            {
-                if (null != progressStyle?.Buffer)
-                {
-                    progressStyle.Buffer.BackgroundColor = value;
-                }
-            }
+            get => bufferImage.BackgroundColor;
+            set => bufferImage.BackgroundColor = value;
         }
 
         /// <summary>
@@ -399,6 +333,35 @@ namespace Tizen.NUI.Components
             }
         }
 
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnInitialize()
+        {
+            base.OnInitialize();
+            // create necessary components
+            InitializeTrack();
+            InitializeBuffer();
+            InitializeProgress();
+        }
+
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void ApplyStyle(ViewStyle style)
+        {
+            base.ApplyStyle(style);
+
+            if (style is ProgressStyle progressStyle)
+            {
+                Debug.Assert(trackImage != null);
+                Debug.Assert(progressImage != null);
+                Debug.Assert(bufferImage != null);
+
+                trackImage.ApplyStyle(progressStyle.Track);
+                progressImage.ApplyStyle(progressStyle.Progress);
+                bufferImage.ApplyStyle(progressStyle.Buffer);
+            }
+        }
+
         /// <summary>
         /// Dispose Progress and all children on it.
         /// </summary>
@@ -507,14 +470,6 @@ namespace Tizen.NUI.Components
             }
         }
 
-        private void Initialize()
-        {
-            // create necessary components
-            InitializeTrack();
-            InitializeBuffer();
-            InitializeProgress();
-        }
-
         private void InitializeTrack()
         {
             if (null == trackImage)
@@ -528,7 +483,6 @@ namespace Tizen.NUI.Components
                     PivotPoint = NUI.PivotPoint.TopLeft
                 };
                 Add(trackImage);
-                trackImage.ApplyStyle(progressStyle.Track);
             }
         }
 
@@ -545,7 +499,6 @@ namespace Tizen.NUI.Components
                     PivotPoint = Tizen.NUI.PivotPoint.TopLeft
                 };
                 Add(progressImage);
-                progressImage.ApplyStyle(progressStyle.Progress);
             }
         }
 
@@ -562,7 +515,6 @@ namespace Tizen.NUI.Components
                     PivotPoint = Tizen.NUI.PivotPoint.TopLeft
                 };
                 Add(bufferImage);
-                bufferImage.ApplyStyle(progressStyle.Buffer);
             }
         }
     }
index 41cd43d..5aacfd1 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
@@ -84,21 +84,6 @@ namespace Tizen.NUI.Components
 
         /// <inheritdoc/>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public override void ApplyStyle(ViewStyle viewStyle)
-        {
-            if (viewStyle is ButtonStyle buttonStyle)
-            {
-                if (buttonStyle.IsSelectable == null)
-                {
-                    buttonStyle.IsSelectable = true;
-                }
-
-                base.ApplyStyle(buttonStyle);
-            }
-        }
-
-        /// <inheritdoc/>
-        [EditorBrowsable(EditorBrowsableState.Never)]
         protected override ImageView CreateIcon()
         {
             return new ImageView
index 72a29b3..e2d75a9 100755 (executable)
@@ -37,28 +37,6 @@ namespace Tizen.NUI.Components
 
         private DefaultGridItemStyle ItemStyle => ViewStyle as DefaultGridItemStyle;
 
-        /// <summary>
-        /// Return a copied Style instance of DefaultLinearItem
-        /// </summary>
-        /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the DefaultLinearItem.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
-        /// </remarks>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public new DefaultGridItemStyle Style
-        {
-            get
-            {
-                var result = new DefaultGridItemStyle(ItemStyle);
-                result.CopyPropertiesFromView(this);
-                if (itemCaption) result.Caption.CopyPropertiesFromView(itemCaption);
-                if (itemImage) result.Image.CopyPropertiesFromView(itemImage);
-                if (itemBadge) result.Badge.CopyPropertiesFromView(itemBadge);
-
-                return result;
-            }
-        }
-
         static DefaultGridItem() { }
 
         /// <summary>
index 6fbb8d2..0c38475 100755 (executable)
@@ -38,30 +38,6 @@ namespace Tizen.NUI.Components
         private Size prevSize;
         private DefaultLinearItemStyle ItemStyle => ViewStyle as DefaultLinearItemStyle;
 
-        /// <summary>
-        /// Return a copied Style instance of DefaultLinearItem
-        /// </summary>
-        /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the DefaultLinearItem.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
-        /// </remarks>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public new DefaultLinearItemStyle Style
-        {
-            get
-            {
-                var result = new DefaultLinearItemStyle(ItemStyle);
-                result.CopyPropertiesFromView(this);
-                if (itemLabel) result.Label.CopyPropertiesFromView(itemLabel);
-                if (itemSubLabel) result.SubLabel.CopyPropertiesFromView(itemSubLabel);
-                if (itemIcon) result.Icon.CopyPropertiesFromView(itemIcon);
-                if (itemExtra) result.Extra.CopyPropertiesFromView(itemExtra);
-                if (itemSeperator) result.Seperator.CopyPropertiesFromView(itemSeperator);
-
-                return result;
-            }
-        }
-
         static DefaultLinearItem() { }
 
         /// <summary>
index b57da30..8979aa2 100755 (executable)
@@ -36,28 +36,6 @@ namespace Tizen.NUI.Components
         private Size prevSize;
         private DefaultTitleItemStyle ItemStyle => ViewStyle as DefaultTitleItemStyle;
 
-        /// <summary>
-        /// Return a copied Style instance of DefaultTitleItem
-        /// </summary>
-        /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the DefaultTitleItem.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
-        /// </remarks>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public new DefaultTitleItemStyle Style
-        {
-            get
-            {
-                var result = new DefaultTitleItemStyle(ItemStyle);
-                result.CopyPropertiesFromView(this);
-                if (itemLabel) result.Label.CopyPropertiesFromView(itemLabel);
-                if (itemIcon) result.Icon.CopyPropertiesFromView(itemIcon);
-                if (itemSeperator) result.Seperator.CopyPropertiesFromView(itemSeperator);
-
-                return result;
-            }
-        }
-
         static DefaultTitleItem() { }
 
         /// <summary>
index ac8245a..9112b5d 100755 (executable)
@@ -41,10 +41,6 @@ namespace Tizen.NUI.Components
                 if (instance.isEnabled != newEnabled)
                 {
                     instance.isEnabled = newEnabled;
-                    if (instance.ItemStyle != null)
-                    {
-                        instance.ItemStyle.IsEnabled = newEnabled;
-                    }
                     instance.UpdateState();
                 }
             }
@@ -65,11 +61,6 @@ namespace Tizen.NUI.Components
                 {
                     instance.isSelected = newSelected;
 
-                    if (instance.ItemStyle != null)
-                    {
-                        instance.ItemStyle.IsSelected = newSelected;
-                    }
-
                     if (instance.isSelectable)
                     {
                         instance.UpdateState();
@@ -96,12 +87,6 @@ namespace Tizen.NUI.Components
                 if (instance.isSelectable != newSelectable)
                 {
                     instance.isSelectable = newSelectable;
-
-                    if (instance.ItemStyle != null)
-                    {
-                        instance.ItemStyle.IsSelectable = newSelectable;
-                    }
-
                     instance.UpdateState();
                 }
             }
@@ -113,24 +98,6 @@ namespace Tizen.NUI.Components
         private bool isEnabled = true;
         private RecyclerViewItemStyle ItemStyle => ViewStyle as RecyclerViewItemStyle;
 
-        /// <summary>
-        /// Return a copied Style instance of Toast
-        /// </summary>
-        /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the Toast.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
-        /// </remarks>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public new RecyclerViewItemStyle Style
-        {
-            get
-            {
-                var result = new RecyclerViewItemStyle(ItemStyle);
-                result.CopyPropertiesFromView(this);
-                return result;
-            }
-        }
-
         static RecyclerViewItem() { }
 
         /// <summary>
index 2480bf2..ebfd084 100755 (executable)
@@ -16,6 +16,7 @@
  */
 using System;
 using System.ComponentModel;
+using System.Diagnostics;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Binding;
 
@@ -34,78 +35,38 @@ namespace Tizen.NUI.Components
 
         /// <summary>Bindable property of TrackThickness</summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty TrackThicknessProperty = BindableProperty.Create(nameof(TrackThickness), typeof(float), typeof(Scrollbar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
-        {
-            var instance = ((Scrollbar)bindable);
-            var thickness = (float?)newValue;
-
-            instance.scrollbarStyle.TrackThickness = thickness;
-            instance.UpdateTrackThickness(thickness ?? 0);
-        },
-        defaultValueCreator: (bindable) =>
-        {
-            return ((Scrollbar)bindable).scrollbarStyle.TrackThickness ?? 0;
-        });
+        public static readonly BindableProperty TrackThicknessProperty = BindableProperty.Create(nameof(TrackThickness), typeof(float), typeof(Scrollbar), default(float),
+            propertyChanged: (bindable, oldValue, newValue) => ((Scrollbar)bindable).UpdateTrackThickness((float?)newValue ?? 0),
+            defaultValueCreator: (bindable) => ((Scrollbar)bindable).trackThickness
+        );
 
         /// <summary>Bindable property of ThumbThickness</summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty ThumbThicknessProperty = BindableProperty.Create(nameof(ThumbThickness), typeof(float), typeof(Scrollbar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
-        {
-            var instance = ((Scrollbar)bindable);
-            var thickness = (float?)newValue;
-
-            instance.scrollbarStyle.ThumbThickness = thickness;
-            instance.UpdateThumbThickness(thickness ?? 0);
-        },
-        defaultValueCreator: (bindable) =>
-        {
-            return ((Scrollbar)bindable).scrollbarStyle.ThumbThickness ?? 0;
-        });
+        public static readonly BindableProperty ThumbThicknessProperty = BindableProperty.Create(nameof(ThumbThickness), typeof(float), typeof(Scrollbar), default(float),
+            propertyChanged: (bindable, oldValue, newValue) => ((Scrollbar)bindable).UpdateThumbThickness((float?)newValue ?? 0),
+            defaultValueCreator: (bindable) => ((Scrollbar)bindable).thumbThickness
+        );
 
         /// <summary>Bindable property of TrackColor</summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(Scrollbar), null, propertyChanged: (bindable, oldValue, newValue) =>
-        {
-            var instance = ((Scrollbar)bindable);
-            var color = (Color)newValue;
-
-            instance.scrollbarStyle.TrackColor = color;
-            instance.UpdateTrackColor(color);
-        },
-        defaultValueCreator: (bindable) =>
-        {
-            return ((Scrollbar)bindable).scrollbarStyle.TrackColor;
-        });
+        public static readonly BindableProperty TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(Scrollbar), null,
+            propertyChanged: (bindable, oldValue, newValue) => ((Scrollbar)bindable).UpdateTrackColor((Color)newValue),
+            defaultValueCreator: (bindable) => ((Scrollbar)bindable).trackVisual.MixColor
+        );
 
         /// <summary>Bindable property of ThumbColor</summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(Scrollbar), null, propertyChanged: (bindable, oldValue, newValue) =>
-        {
-            var instance = ((Scrollbar)bindable);
-            var color = (Color)newValue;
-
-            instance.scrollbarStyle.ThumbColor = color;
-            instance.UpdateThumbColor(color);
-        },
-        defaultValueCreator: (bindable) =>
-        {
-            return ((Scrollbar)bindable).scrollbarStyle.ThumbColor;
-        });
+        public static readonly BindableProperty ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(Scrollbar), null,
+            propertyChanged: (bindable, oldValue, newValue) => ((Scrollbar)bindable).UpdateThumbColor((Color)newValue),
+            defaultValueCreator: (bindable) => ((Scrollbar)bindable).thumbVisual.MixColor
+        );
 
         /// <summary>Bindable property of TrackPadding</summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty TrackPaddingProperty = BindableProperty.Create(nameof(TrackPadding), typeof(Extents), typeof(Scrollbar), null, propertyChanged: (bindable, oldValue, newValue) =>
-        {
-            var instance = ((Scrollbar)bindable);
-            var trackPadding = (Extents)newValue;
-
-            instance.scrollbarStyle.TrackPadding = trackPadding;
-            instance.UpdateTrackPadding(trackPadding);
-        },
-        defaultValueCreator: (bindable) =>
-        {
-            return ((Scrollbar)bindable).scrollbarStyle.TrackPadding;
-        });
+        public static readonly BindableProperty TrackPaddingProperty = BindableProperty.Create(nameof(TrackPadding), typeof(Extents), typeof(Scrollbar), null,
+            propertyChanged: (bindable, oldValue, newValue) => ((Scrollbar)bindable).UpdateTrackPadding((Extents)newValue),
+            defaultValueCreator: (bindable) => ((Scrollbar)bindable).trackPadding
+        );
 
         private ColorVisual trackVisual;
         private ColorVisual thumbVisual;
@@ -113,9 +74,11 @@ namespace Tizen.NUI.Components
         private Animation thumbSizeAnimation;
         private Calculator calculator;
         private Size containerSize = new Size(0, 0);
-        private ScrollbarStyle scrollbarStyle => ViewStyle as ScrollbarStyle;
         private bool mScrollEnabled = true;
         private float previousPosition;
+        private float trackThickness;
+        private float thumbThickness;
+        private PaddingType trackPadding;
 
         #endregion Fields
 
@@ -221,6 +184,29 @@ namespace Tizen.NUI.Components
 
         /// <inheritdoc/>
         [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnInitialize()
+        {
+            base.OnInitialize();
+
+            trackVisual = new ColorVisual
+            {
+                SuppressUpdateVisual = true,
+                SizePolicy = VisualTransformPolicyType.Absolute,
+                MixColor = Color.Transparent,
+            };
+            AddVisual("Track", trackVisual);
+
+            thumbVisual = new ColorVisual
+            {
+                SuppressUpdateVisual = true,
+                SizePolicy = VisualTransformPolicyType.Absolute,
+                MixColor = Color.Transparent,
+            };
+            AddVisual("Thumb", thumbVisual);
+        }
+
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public override void Initialize(float contentLength, float viewportLength, float currentPosition, bool isHorizontal = false)
         {
             if (isHorizontal)
@@ -238,38 +224,27 @@ namespace Tizen.NUI.Components
             thumbSizeAnimation?.Stop();
             thumbSizeAnimation = null;
 
-            PaddingType ensuredPadding = EnsurePadding(TrackPadding);
-            Size trackSize = calculator.CalculateTrackSize(TrackThickness, containerSize, ensuredPadding);
-            Vector2 trackPosition = calculator.CalculateTrackPosition(ensuredPadding);
+            Size trackSize = calculator.CalculateTrackSize(TrackThickness, containerSize, trackPadding);
+            Vector2 trackPosition = calculator.CalculateTrackPosition(trackPadding);
             Size thumbSize = calculator.CalculateThumbSize(ThumbThickness, trackSize);
-            Vector2 thumbPosition = calculator.CalculateThumbPosition(trackSize, thumbSize, ensuredPadding);
-
-            trackVisual = new ColorVisual
-            {
-                SuppressUpdateVisual = true,
-                MixColor = TrackColor,
-                SizePolicy = VisualTransformPolicyType.Absolute,
-                Origin = calculator.CalculatorTrackAlign(),
-                AnchorPoint = calculator.CalculatorTrackAlign(),
-                Size = trackSize,
-                Position = trackPosition,
-            };
+            Vector2 thumbPosition = calculator.CalculateThumbPosition(trackSize, thumbSize, trackPadding);
 
-            AddVisual("Track", trackVisual);
+            Debug.Assert(trackVisual != null && thumbVisual != null);
 
-            thumbVisual = new ColorVisual
-            {
-                SuppressUpdateVisual = true,
-                MixColor = ThumbColor,
-                SizePolicy = VisualTransformPolicyType.Absolute,
-                Origin = calculator.CalculatorThumbAlign(),
-                AnchorPoint = calculator.CalculatorThumbAlign(),
-                Opacity = calculator.CalculateThumbVisibility() ? 1.0f : 0.0f,
-                Size = thumbSize,
-                Position = thumbPosition,
-            };
+            trackVisual.MixColor = TrackColor;
+            trackVisual.Origin = calculator.CalculatorTrackAlign();
+            trackVisual.AnchorPoint = calculator.CalculatorTrackAlign();
+            trackVisual.Size = trackSize;
+            trackVisual.Position = trackPosition;
+            trackVisual.UpdateVisual(true);
 
-            AddVisual("Thumb", thumbVisual);
+            thumbVisual.MixColor = ThumbColor;
+            thumbVisual.Origin = calculator.CalculatorThumbAlign();
+            thumbVisual.AnchorPoint = calculator.CalculatorThumbAlign();
+            thumbVisual.Opacity = calculator.CalculateThumbVisibility() ? 1.0f : 0.0f;
+            thumbVisual.Size = thumbSize;
+            thumbVisual.Position = thumbPosition;
+            thumbVisual.UpdateVisual(true);
         }
 
         /// <inheritdoc/>
@@ -287,7 +262,7 @@ namespace Tizen.NUI.Components
             calculator.currentPosition = position;
 
             thumbVisual.Size = calculator.CalculateThumbSize(ThumbThickness, trackVisual.Size);
-            thumbVisual.Position = calculator.CalculateThumbScrollPosition(trackVisual.Size, thumbVisual.Position, EnsurePadding(TrackPadding));
+            thumbVisual.Position = calculator.CalculateThumbScrollPosition(trackVisual.Size, thumbVisual.Position, trackPadding);
             thumbVisual.Opacity = calculator.CalculateThumbVisibility() ? 1.0f : 0.0f;
 
             if (durationMs == 0)
@@ -326,7 +301,7 @@ namespace Tizen.NUI.Components
 
             previousPosition = calculator.currentPosition;
             calculator.currentPosition = position;
-            thumbVisual.Position = calculator.CalculateThumbScrollPosition(trackVisual.Size, thumbVisual.Position, EnsurePadding(TrackPadding));
+            thumbVisual.Position = calculator.CalculateThumbScrollPosition(trackVisual.Size, thumbVisual.Position, trackPadding);
 
             if (durationMs == 0)
             {
@@ -361,11 +336,10 @@ namespace Tizen.NUI.Components
                 return;
             }
 
-            PaddingType ensuredPadding = EnsurePadding(TrackPadding);
-            trackVisual.Size = calculator.CalculateTrackSize(TrackThickness, containerSize, ensuredPadding);
-            trackVisual.Position = calculator.CalculateTrackPosition(ensuredPadding);
+            trackVisual.Size = calculator.CalculateTrackSize(TrackThickness, containerSize, trackPadding);
+            trackVisual.Position = calculator.CalculateTrackPosition(trackPadding);
             thumbVisual.Size = calculator.CalculateThumbSize(ThumbThickness, trackVisual.Size);
-            thumbVisual.Position = calculator.CalculateThumbPosition(trackVisual.Size, thumbVisual.Size, ensuredPadding);
+            thumbVisual.Position = calculator.CalculateThumbPosition(trackVisual.Size, thumbVisual.Size, trackPadding);
 
             trackVisual.UpdateVisual(true);
             thumbVisual.UpdateVisual(true);
@@ -404,12 +378,14 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected virtual void UpdateTrackThickness(float thickness)
         {
-            if (trackVisual == null)
+            trackThickness = thickness;
+
+            if (calculator == null)
             {
                 return;
             }
 
-            trackVisual.Size = calculator.CalculateTrackSize(thickness, containerSize, EnsurePadding(TrackPadding));
+            trackVisual.Size = calculator.CalculateTrackSize(thickness, containerSize, trackPadding);
             trackVisual.UpdateVisual(true);
         }
 
@@ -420,7 +396,9 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected virtual void UpdateThumbThickness(float thickness)
         {
-            if (thumbVisual == null)
+            thumbThickness = thickness;
+
+            if (calculator == null)
             {
                 return;
             }
@@ -464,19 +442,20 @@ namespace Tizen.NUI.Components
         /// <summary>
         /// Update TrackPadding property of the scrollbar.
         /// </summary>
-        /// <param name="trackPadding">The padding of the track.</param>
-        protected virtual void UpdateTrackPadding(Extents trackPadding)
+        /// <param name="padding">The padding of the track.</param>
+        protected virtual void UpdateTrackPadding(Extents padding)
         {
+            trackPadding = padding == null ? new PaddingType(0, 0, 0, 0) : new PaddingType(padding.Start, padding.End, padding.Top, padding.Bottom);
+
             if (calculator == null)
             {
                 return;
             }
 
-            PaddingType ensuredPadding = EnsurePadding(trackPadding);
-            trackVisual.Size = calculator.CalculateTrackSize(TrackThickness, containerSize, ensuredPadding);
-            trackVisual.Position = calculator.CalculateTrackPosition(ensuredPadding);
+            trackVisual.Size = calculator.CalculateTrackSize(TrackThickness, containerSize, trackPadding);
+            trackVisual.Position = calculator.CalculateTrackPosition(trackPadding);
             thumbVisual.Size = calculator.CalculateThumbSize(ThumbThickness, trackVisual.Size);
-            thumbVisual.Position = calculator.CalculateThumbPaddingPosition(trackVisual.Size, thumbVisual.Size, thumbVisual.Position, ensuredPadding);
+            thumbVisual.Position = calculator.CalculateThumbPaddingPosition(trackVisual.Size, thumbVisual.Size, thumbVisual.Position, trackPadding);
 
             trackVisual.UpdateVisual(true);
             thumbVisual.UpdateVisual(true);
@@ -555,7 +534,7 @@ namespace Tizen.NUI.Components
             }
         }
 
-        private PaddingType EnsurePadding(Extents padding) => padding == null ? new PaddingType(0, 0, 0, 0) : new PaddingType(padding.Start, padding.End, padding.Top, padding.Bottom);
+        // private PaddingType EnsurePadding(Extents padding) => padding == null ? new PaddingType(0, 0, 0, 0) : new PaddingType(padding.Start, padding.End, padding.Top, padding.Bottom);
 
         #endregion Methods
 
index faca838..f9204f3 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
@@ -52,7 +52,6 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public SelectButton() : base()
         {
-            Initialize();
         }
 
         /// <summary>
@@ -64,7 +63,6 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public SelectButton(string style) : base(style)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -76,7 +74,6 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public SelectButton(ButtonStyle buttonStyle) : base(buttonStyle)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -116,6 +113,14 @@ namespace Tizen.NUI.Components
             }
         }
 
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnInitialize()
+        {
+            base.OnInitialize();
+            IsSelectable = true;
+        }
+
         /// <summary>
         /// Dispose SelectButton and all children on it.
         /// </summary>
@@ -213,11 +218,6 @@ namespace Tizen.NUI.Components
         {
         }
 
-        private void Initialize()
-        {
-            IsSelectable = true;
-        }
-
         /// <inheritdoc/>
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected override void OnControlStateChanged(ControlStateChangedEventArgs info)
index d0a3aaf..d6be5de 100755 (executable)
@@ -582,11 +582,11 @@ namespace Tizen.NUI.Components
             {
                 if (lowIndicatorImage != null && lowIndicatorImage != null && lowIndicatorImage.Size != null)
                 {
-                    lowIndicatorImage.Size = sliderStyle.LowIndicatorImage.Size;
+                    lowIndicatorImage.Size = lowIndicatorSize ?? (ViewStyle as SliderStyle)?.LowIndicatorImage.Size;
                 }
                 if (lowIndicatorText != null && lowIndicatorText != null && lowIndicatorText.Size != null)
                 {
-                    lowIndicatorText.Size = sliderStyle.LowIndicator.Size;
+                    lowIndicatorText.Size = lowIndicatorSize ?? (ViewStyle as SliderStyle)?.LowIndicator.Size;
                 }
             }
         }
@@ -748,7 +748,7 @@ namespace Tizen.NUI.Components
             }
             else
             {
-                if (sliderStyle != null && sliderStyle.TrackThickness != null)
+                if (ViewStyle is SliderStyle sliderStyle && sliderStyle.TrackThickness != null)
                 {
                     curTrackThickness = sliderStyle.TrackThickness.Value;
                 }
@@ -765,7 +765,7 @@ namespace Tizen.NUI.Components
             }
             else
             {
-                if (sliderStyle != null && sliderStyle.TrackPadding != null)
+                if (ViewStyle is SliderStyle sliderStyle && sliderStyle.TrackPadding != null)
                 {
                     curSpace = sliderStyle.TrackPadding.Start;
                 }
@@ -797,7 +797,7 @@ namespace Tizen.NUI.Components
         private IndicatorType CurrentIndicatorType()
         {
             IndicatorType type = IndicatorType.None;
-            if (sliderStyle != null)
+            if (ViewStyle is SliderStyle sliderStyle)
             {
                 type = (IndicatorType)sliderStyle.IndicatorType;
             }
@@ -813,7 +813,7 @@ namespace Tizen.NUI.Components
             }
             else
             {
-                if (sliderStyle != null && sliderStyle.LowIndicatorImage != null && sliderStyle.LowIndicatorImage.Size != null)
+                if (ViewStyle is SliderStyle sliderStyle && sliderStyle.LowIndicatorImage != null && sliderStyle.LowIndicatorImage.Size != null)
                 {
                     size = sliderStyle.LowIndicatorImage.Size;
                 }
@@ -830,7 +830,7 @@ namespace Tizen.NUI.Components
             }
             else
             {
-                if (sliderStyle != null && sliderStyle.HighIndicatorImage != null && sliderStyle.HighIndicatorImage.Size != null)
+                if (ViewStyle is SliderStyle sliderStyle && sliderStyle.HighIndicatorImage != null && sliderStyle.HighIndicatorImage.Size != null)
                 {
                     size = sliderStyle.HighIndicatorImage.Size;
                 }
@@ -847,7 +847,7 @@ namespace Tizen.NUI.Components
             }
             else
             {
-                if (sliderStyle != null && sliderStyle.LowIndicator != null && sliderStyle.LowIndicator.Size != null)
+                if (ViewStyle is SliderStyle sliderStyle && sliderStyle.LowIndicator != null && sliderStyle.LowIndicator.Size != null)
                 {
                     size = sliderStyle.LowIndicator.Size;
                 }
@@ -864,7 +864,7 @@ namespace Tizen.NUI.Components
             }
             else
             {
-                if (sliderStyle != null && sliderStyle.HighIndicator != null && sliderStyle.HighIndicator.Size != null)
+                if (ViewStyle is SliderStyle sliderStyle && sliderStyle.HighIndicator != null && sliderStyle.HighIndicator.Size != null)
                 {
                     size = sliderStyle.HighIndicator.Size;
                 }
index ea8fe35..bbdd0ad 100755 (executable)
@@ -153,10 +153,6 @@ namespace Tizen.NUI.Components
             {
                 string newText = (string)newValue;
                 instance.valueIndicatorText.Text = newText;
-                if (instance.sliderStyle != null)
-                {
-                    instance.sliderStyle.ValueIndicatorText.Text = newText;
-                }
             }
         },
         defaultValueCreator: (bindable) =>
@@ -334,36 +330,13 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// Return a copied Style instance of Slider
+        /// Return currently applied style.
         /// </summary>
         /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the Slider.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
+        /// Modifying contents in style may cause unexpected behaviour.
         /// </remarks>
         /// <since_tizen> 8 </since_tizen>
-        public new SliderStyle Style
-        {
-            get
-            {
-                var result = new SliderStyle(sliderStyle);
-                result.CopyPropertiesFromView(this);
-                result.Track.CopyPropertiesFromView(bgTrackImage);
-                result.Progress.CopyPropertiesFromView(slidedTrackImage);
-                result.Thumb.CopyPropertiesFromView(thumbImage);
-                result.LowIndicatorImage.CopyPropertiesFromView(lowIndicatorImage);
-                result.HighIndicatorImage.CopyPropertiesFromView(highIndicatorImage);
-                result.LowIndicator.CopyPropertiesFromView(lowIndicatorText);
-                result.HighIndicator.CopyPropertiesFromView(highIndicatorText);
-                result.ValueIndicatorText.CopyPropertiesFromView(valueIndicatorText);
-                result.ValueIndicatorImage.CopyPropertiesFromView(valueIndicatorImage);
-                return result;
-            }
-        }
-
-        /// <summary>
-        /// Return a copied Style instance of Slider
-        /// </summary>
-        private SliderStyle sliderStyle => ViewStyle as SliderStyle;
+        public SliderStyle Style => (SliderStyle)(ViewStyle as SliderStyle)?.Clone();
 
         /// <summary>
         /// Gets or sets the direction type of slider.
@@ -477,7 +450,6 @@ namespace Tizen.NUI.Components
                 {
                     thumbImage.Size = value;
                     thumbSize = value;
-                    sliderStyle.Thumb.Size = value;
                 }
             }
         }
@@ -500,7 +472,6 @@ namespace Tizen.NUI.Components
                 {
                     thumbImage.ResourceUrl = value;
                     thumbImageUrl = value;
-                    sliderStyle.Thumb.ResourceUrl = value;
                 }
             }
         }
@@ -580,7 +551,6 @@ namespace Tizen.NUI.Components
                 {
                     thumbImage.BackgroundColor = value;
                     thumbColor = value;
-                    sliderStyle.Thumb.BackgroundColor = value;
                 }
             }
         }
@@ -600,7 +570,6 @@ namespace Tizen.NUI.Components
                 if (null != bgTrackImage)
                 {
                     bgTrackImage.BackgroundColor = value;
-                    sliderStyle.Track.BackgroundColor = value;
                 }
             }
         }
@@ -620,7 +589,6 @@ namespace Tizen.NUI.Components
                 if (null != slidedTrackImage)
                 {
                     slidedTrackImage.BackgroundColor = value;
-                    sliderStyle.Progress.BackgroundColor = value;
                 }
             }
         }
@@ -675,7 +643,6 @@ namespace Tizen.NUI.Components
                 if (null != warningTrackImage)
                 {
                     warningTrackImage.BackgroundColor = value;
-                    sliderStyle.WarningTrack.BackgroundColor = value;
                 }
             }
         }
@@ -696,7 +663,6 @@ namespace Tizen.NUI.Components
                 if (null != warningSlidedTrackImage)
                 {
                     warningSlidedTrackImage.BackgroundColor = value;
-                    sliderStyle.WarningProgress.BackgroundColor = value;
                 }
             }
         }
@@ -774,7 +740,6 @@ namespace Tizen.NUI.Components
             {
                 if (null == lowIndicatorImage) lowIndicatorImage = new ImageView();
                 lowIndicatorImage.ResourceUrl = value;
-                sliderStyle.LowIndicatorImage.ResourceUrl = value;
             }
         }
 
@@ -792,7 +757,6 @@ namespace Tizen.NUI.Components
             {
                 if (null == highIndicatorImage) highIndicatorImage = new ImageView();
                 highIndicatorImage.ResourceUrl = value;
-                sliderStyle.HighIndicatorImage.ResourceUrl = value;
             }
         }
 
@@ -811,7 +775,6 @@ namespace Tizen.NUI.Components
                 if (null != lowIndicatorText)
                 {
                     lowIndicatorText.Text = value;
-                    sliderStyle.LowIndicator.Text = value;
                 }
             }
         }
@@ -831,7 +794,6 @@ namespace Tizen.NUI.Components
                 if (null != highIndicatorText)
                 {
                     highIndicatorText.Text = value;
-                    sliderStyle.HighIndicator.Text = value;
                 }
             }
         }
@@ -871,7 +833,6 @@ namespace Tizen.NUI.Components
                 if (null != highIndicatorText)
                 {
                     highIndicatorText.Size = value;
-                    sliderStyle.HighIndicator.Size = value;
                 }
             }
         }
@@ -942,7 +903,6 @@ namespace Tizen.NUI.Components
                 if (null != valueIndicatorImage)
                 {
                     valueIndicatorImage.Size = value;
-                    sliderStyle.ValueIndicatorImage.Size = value;
                 }
             }
         }
@@ -963,7 +923,6 @@ namespace Tizen.NUI.Components
                 if (null != valueIndicatorImage)
                 {
                     valueIndicatorImage.ResourceUrl = value;
-                    sliderStyle.ValueIndicatorImage.ResourceUrl = value;
                 }
             }
         }
index c8fedd6..42995fb 100755 (executable)
@@ -39,7 +39,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public Switch() : base()
         {
-            Initialize();
         }
 
         /// <summary>
@@ -49,7 +48,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Switch(string style) : base(style)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -59,7 +57,6 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public Switch(SwitchStyle switchStyle) : base(switchStyle)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -70,6 +67,10 @@ namespace Tizen.NUI.Components
         {
             base.OnInitialize();
             SetAccessibilityConstructor(Role.ToggleButton);
+            IsSelectable = true;
+#if PROFILE_MOBILE
+            Feedback = true;
+#endif
         }
 
         /// <summary>
@@ -97,24 +98,13 @@ namespace Tizen.NUI.Components
         public event EventHandler<SelectedChangedEventArgs> SelectedChanged;
 
         /// <summary>
-        /// Return a copied Style instance of Switch
+        /// Return currently applied style.
         /// </summary>
         /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the Switch.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
+        /// Modifying contents in style may cause unexpected behaviour.
         /// </remarks>
         /// <since_tizen> 8 </since_tizen>
-        public new SwitchStyle Style
-        {
-            get
-            {
-                var result = new SwitchStyle(ViewStyle as SwitchStyle);
-                result.CopyPropertiesFromView(this);
-                result.Track.CopyPropertiesFromView(Track);
-                result.Thumb.CopyPropertiesFromView(Thumb);
-                return result;
-            }
-        }
+        public new SwitchStyle Style => (SwitchStyle)(ViewStyle as SwitchStyle)?.Clone();
 
         /// <summary>
         /// Apply style to switch.
@@ -123,8 +113,6 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public override void ApplyStyle(ViewStyle viewStyle)
         {
-            base.ApplyStyle(viewStyle);
-
             SwitchStyle swStyle = viewStyle as SwitchStyle;
 
             if (null != swStyle)
@@ -139,6 +127,8 @@ namespace Tizen.NUI.Components
                     Thumb.ApplyStyle(swStyle.Thumb);
                 }
             }
+
+            base.ApplyStyle(viewStyle);
         }
 
         /// <summary>
@@ -335,14 +325,6 @@ namespace Tizen.NUI.Components
             }
         }
 
-        private void Initialize()
-        {
-            IsSelectable = true;
-#if PROFILE_MOBILE
-                Feedback = true;
-#endif
-        }
-
         private void OnSelect()
         {
             if (IsHighlighted)
index e461639..aa596ef 100755 (executable)
@@ -78,23 +78,13 @@ namespace Tizen.NUI.Components
         public event EventHandler<ItemChangedEventArgs> ItemChangedEvent;
 
         /// <summary>
-        /// Return a copied Style instance of Tab
+        /// Return currently applied style.
         /// </summary>
         /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the Tab.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
+        /// Modifying contents in style may cause unexpected behaviour.
         /// </remarks>
         /// <since_tizen> 8 </since_tizen>
-        public new TabStyle Style
-        {
-            get
-            {
-                var result = new TabStyle(tabStyle);
-                result.CopyPropertiesFromView(this);
-                result.UnderLine.CopyPropertiesFromView(underline);
-                return result;
-            }
-        }
+        public TabStyle Style => (TabStyle)(ViewStyle as TabStyle)?.Clone();
 
         /// <summary>
         /// Get underline of Tab.
index bf221aa..061f135 100755 (executable)
@@ -58,7 +58,6 @@ namespace Tizen.NUI.Components
             var instance = (Toast)bindable;
             if (newValue != null)
             {
-                instance.toastStyle.Duration = (uint)newValue;
                 if (instance.timer == null)
                 {
                     instance.timer = new Timer(instance.duration);
@@ -69,7 +68,7 @@ namespace Tizen.NUI.Components
         defaultValueCreator: (bindable) =>
         {
             var instance = (Toast)bindable;
-            return instance.toastStyle.Duration ?? instance.duration;
+            return instance.timer == null ? instance.duration : instance.timer.Interval;
         });
 
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -89,26 +88,7 @@ namespace Tizen.NUI.Components
         private string strText = null;
         private Timer timer = null;
         private readonly uint duration = 3000;
-        private ToastStyle toastStyle => ViewStyle as ToastStyle;
 
-        /// <summary>
-        /// Return a copied Style instance of Toast
-        /// </summary>
-        /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the Toast.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
-        /// </remarks>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public new ToastStyle Style
-        {
-            get
-            {
-                var result = new ToastStyle(toastStyle);
-                result.CopyPropertiesFromView(this);
-                result.Text.CopyPropertiesFromView(textLabel);
-                return result;
-            }
-        }
         static Toast() { }
 
         /// <summary>
@@ -118,7 +98,6 @@ namespace Tizen.NUI.Components
         [Obsolete("Deprecated in API8; Will be removed in API10")]
         public Toast() : base()
         {
-            Initialize();
         }
 
         /// <summary>
@@ -128,7 +107,6 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public Toast(ToastStyle toastStyle) : base(toastStyle)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -138,7 +116,6 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public Toast(string style) : base(style)
         {
-            Initialize();
         }
 
         /// <summary>
@@ -314,6 +291,33 @@ namespace Tizen.NUI.Components
             }
         }
 
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnInitialize()
+        {
+            base.OnInitialize();
+
+            WidthResizePolicy = ResizePolicyType.FitToChildren;
+            HeightResizePolicy = ResizePolicyType.FitToChildren;
+
+            textLabel = new TextLabel()
+            {
+                PositionUsesPivotPoint = true,
+                ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+                PivotPoint = Tizen.NUI.PivotPoint.Center,
+                WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+                HeightResizePolicy = ResizePolicyType.UseNaturalSize,
+                HorizontalAlignment = HorizontalAlignment.Center,
+                VerticalAlignment = VerticalAlignment.Center,
+                TextColor = Color.White,
+            };
+            this.Add(textLabel);
+
+            this.VisibilityChanged += OnVisibilityChanged;
+            timer = new Timer(duration);
+            timer.Tick += OnTick;
+        }
+
         /// <summary>
         /// Apply style to toast.
         /// </summary>
@@ -321,30 +325,10 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public override void ApplyStyle(ViewStyle viewStyle)
         {
-            WidthResizePolicy = ResizePolicyType.FitToChildren;
-            HeightResizePolicy = ResizePolicyType.FitToChildren;
-
             base.ApplyStyle(viewStyle);
 
-            ToastStyle toastStyle = viewStyle as ToastStyle;
-
-            if (null != toastStyle)
+            if (viewStyle is ToastStyle toastStyle)
             {
-                if (null == textLabel)
-                {
-                    textLabel = new TextLabel()
-                    {
-                        PositionUsesPivotPoint = true,
-                        ParentOrigin = Tizen.NUI.ParentOrigin.Center,
-                        PivotPoint = Tizen.NUI.PivotPoint.Center,
-                        WidthResizePolicy = ResizePolicyType.UseNaturalSize,
-                        HeightResizePolicy = ResizePolicyType.UseNaturalSize,
-                        HorizontalAlignment = HorizontalAlignment.Center,
-                        VerticalAlignment = VerticalAlignment.Center,
-                        TextColor = Color.White,
-                    };
-                    this.Add(textLabel);
-                }
                 textLabel.ApplyStyle(toastStyle.Text);
             }
         }
@@ -393,29 +377,6 @@ namespace Tizen.NUI.Components
             return new ToastStyle();
         }
 
-        private void Initialize()
-        {
-            if (null == textLabel)
-            {
-                textLabel = new TextLabel()
-                {
-                    PositionUsesPivotPoint = true,
-                    ParentOrigin = Tizen.NUI.ParentOrigin.Center,
-                    PivotPoint = Tizen.NUI.PivotPoint.Center,
-                    WidthResizePolicy = ResizePolicyType.UseNaturalSize,
-                    HeightResizePolicy = ResizePolicyType.UseNaturalSize,
-                    HorizontalAlignment = HorizontalAlignment.Center,
-                    VerticalAlignment = VerticalAlignment.Center,
-                    TextColor = Color.White,
-                };
-                this.Add(textLabel);
-            }
-
-            this.VisibilityChanged += OnVisibilityChanged;
-            timer = new Timer(toastStyle.Duration ?? duration);
-            timer.Tick += OnTick;
-        }
-
         private bool OnTick(object sender, EventArgs e)
         {
             Hide();
index 403daab..216fafa 100755 (executable)
@@ -39,9 +39,9 @@ namespace Tizen.NUI.Components
 
         /// <summary>The IndicatorImageUrlSelector bindable property.</summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty IndicatorImageUrlSelectorProperty = BindableProperty.Create("IndicatorImageUrlSelector", typeof(Selector<string>), typeof(PaginationStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
+        public static readonly BindableProperty IndicatorImageUrlSelectorProperty = BindableProperty.Create("IndicatorImageUrl", typeof(Selector<string>), typeof(PaginationStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
-            ((PaginationStyle)bindable).indicatorImageUrl = ((Selector<string>)newValue)?.Clone();
+            ((PaginationStyle)bindable).indicatorImageUrl = (Selector<string>)newValue;
         },
         defaultValueCreator: (bindable) =>
         {
index ce27093..ddda07e 100755 (executable)
@@ -250,7 +250,9 @@ namespace Tizen.NUI.Components
                 {
                     Normal = FrameworkInformation.ResourcePath + "nui_component_default_pagination_normal_dot.png",
                     Selected = FrameworkInformation.ResourcePath + "nui_component_default_pagination_focus_dot.png",
-                }
+                },
+                IndicatorSize = new Size(10, 10),
+                IndicatorSpacing = 10,
             });
 
             theme.AddStyleWithoutClone("Tizen.NUI.Components.Scrollbar", new ScrollbarStyle()
index 68c0038..d8018dd 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
@@ -616,7 +616,7 @@ namespace Tizen.NUI.Wearable
 
         private void Initialize()
         {
-            circularPaginationStyle = Style as CircularPaginationStyle;
+            circularPaginationStyle = ViewStyle as CircularPaginationStyle;
             if (circularPaginationStyle == null)
             {
                 throw new Exception("CircularPagination style is null.");
index f8e1d87..f996e47 100755 (executable)
@@ -201,24 +201,6 @@ namespace Tizen.NUI.Wearable
         #region Properties
 
         /// <summary>
-        /// Return a copied Style instance of CircularProgress
-        /// </summary>
-        /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the CircularProgress.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
-        /// </remarks>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public new CircularProgressStyle Style
-        {
-            get
-            {
-                var result = new CircularProgressStyle(ViewStyle as CircularProgressStyle);
-                result.CopyPropertiesFromView(this);
-                return result;
-            }
-        }
-
-        /// <summary>
         /// The thickness of the track and progress.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
index fafcd7b..368e9c8 100755 (executable)
@@ -146,24 +146,6 @@ namespace Tizen.NUI.Wearable
         #region Properties
 
         /// <summary>
-        /// Return a copied Style instance of CircularScrollbar
-        /// </summary>
-        /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the CircularScrollbar.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
-        /// </remarks>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public CircularScrollbarStyle Style
-        {
-            get
-            {
-                var result = new CircularScrollbarStyle(ViewStyle as CircularScrollbarStyle);
-                result.CopyPropertiesFromView(this);
-                return result;
-            }
-        }
-
-        /// <summary>
         /// The thickness of the scrollbar and track.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
index 4f2dfa4..eeb5eeb 100755 (executable)
@@ -252,24 +252,6 @@ namespace Tizen.NUI.Wearable
         #region Properties
 
         /// <summary>
-        /// Return a copied Style instance of CircularSlider
-        /// </summary>
-        /// <remarks>
-        /// It returns copied Style instance and changing it does not effect to the CircularSlider.
-        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
-        /// </remarks>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public new CircularSliderStyle Style
-        {
-            get
-            {
-                var result = new CircularSliderStyle(ViewStyle as CircularSliderStyle);
-                result.CopyPropertiesFromView(this);
-                return result;
-            }
-        }
-
-        /// <summary>
         /// The thickness of the track and progress.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
index c03dbbb..660198b 100755 (executable)
@@ -79,16 +79,6 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// Return a copied Style instance of the Title.
-        /// </summary>
-        /// <remarks>
-        /// It returns copied style instance so that changing it does not effect to the view.
-        /// Style setting is possible by using constructor or the function of <see cref="View.ApplyStyle"/>.
-        /// </remarks>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public new TextLabelStyle Style => ViewStyle as TextLabelStyle;
-
-        /// <summary>
         /// The constructor of the Title class with specific Style.
         /// </summary>
         /// <param name="textLabelStyle">Construct Style</param>
index 92677b0..dabf1b9 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -65,9 +65,9 @@ namespace Tizen.NUI.BaseComponents
         /// <param name="behaviour">CustomView Behaviour</param>
         /// <param name="viewStyle">CustomView ViewStyle</param>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public CustomView(string typeName, CustomViewBehaviour behaviour, ViewStyle viewStyle) : base(typeName, new ViewWrapperImpl(behaviour), viewStyle)
+        public CustomView(string typeName, CustomViewBehaviour behaviour, ViewStyle viewStyle) : this(typeName, behaviour)
         {
-            Initialize();
+            InitializeStyle(viewStyle);
         }
 
         /// <summary>
@@ -138,7 +138,8 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// This method is called after the control has been initialized.<br />
+        /// This method is called after the CustomView has been initialized.<br />
+        /// After OnInitialize, the view will apply the style if it exists in the theme or it was given from constructor.<br />
         /// Derived classes should do any second phase initialization by overriding this method.<br />
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
@@ -916,13 +917,12 @@ namespace Tizen.NUI.BaseComponents
             viewWrapperImpl.OnTap = new ViewWrapperImpl.OnTapDelegate(OnTap);
             viewWrapperImpl.OnLongPress = new ViewWrapperImpl.OnLongPressDelegate(OnLongPress);
 
-            // Make sure CustomView is initialized.
-            OnInitialize();
-
             // Set the StyleName the name of the View
             // We have to do this because the StyleManager on Native side can't workout it out
             // This will also ensure that the style of views/visuals initialized above are applied by the style manager.
             SetStyleName(this.GetType().Name);
+
+            OnInitialize();
         }
     }
 }
index 0467fd3..707100d 100755 (executable)
@@ -346,6 +346,62 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        private bool EqualsItem(T a, T b)
+        {
+            return Object.ReferenceEquals(a, b) || (a != null && a.Equals(b));
+        }
+
+        /// <summary>
+        /// Determines whether the specified object is equal to the current object.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override bool Equals(System.Object other)
+        {
+            var x = other as Selector<T>;
+
+            if (x == null || x.SelectorItems.Count != SelectorItems.Count)
+            {
+                return false;
+            }
+
+            if (!EqualsItem(All, x.All))
+            {
+                return false;
+            }
+
+            foreach (var item in SelectorItems)
+            {
+                var found = SelectorItems.Find(i => i.State == item.State);
+
+                if (found == null || !EqualsItem(item.Value, found.Value))
+                {
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
+        /// <summary>
+        /// Serves as the default hash function.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override int GetHashCode()
+        {
+            int hash = 17;
+            hash = (hash * 23) + (All == null ? 0 : All.GetHashCode());
+            hash = (hash * 23) + SelectorItems.Count;
+            
+            // Order of items should not effect to the result value.
+            int itemSum = 0;
+            foreach (var item in SelectorItems)
+            {
+                itemSum += item.State.GetHashCode() + (item.Value == null ? 0 : item.Value.GetHashCode());
+            }
+
+            return (hash * 23) + itemSum;
+        }
+
         internal bool HasMultiValue()
         {
             return SelectorItems.Count > 1;
index 176520c..98eb2de 100755 (executable)
@@ -434,13 +434,6 @@ namespace Tizen.NUI.BaseComponents
             return cloned;
         }
 
-        /// <summary>Create a cloned ViewStyle.</summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public void Merge(ViewStyle other)
-        {
-            CopyFrom(other);
-        }
-
         /// <summary>
         /// Release instance.
         /// </summary>
@@ -535,5 +528,29 @@ namespace Tizen.NUI.BaseComponents
         {
             return (ViewStyle)Activator.CreateInstance(GetType());
         }
+
+        /// <summary>Merge other style into the current style without creating new one.</summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        internal void MergeDirectly(ViewStyle other)
+        {
+            CopyFrom(other);
+        }
+    }
+
+    /// <summary> Extension methods for ViewStyle class.</summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public static class ViewStyleExtension
+    {
+        /// <summary>Merge two styles into the new one.</summary>
+        /// <exception cref="ArgumentException">Thrown when failed because of an invalid parameter.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static TOut Merge<TOut>(this TOut value, TOut other) where TOut : Tizen.NUI.BaseComponents.ViewStyle
+        {
+            var newStyle = value.Clone() as TOut;
+
+            newStyle.CopyFrom(other);
+
+            return newStyle;
+        }
     }
 }
index e3fc7f9..0867448 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
@@ -152,9 +152,13 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static bool LayoutingDisabled { get; set; } = true;
 
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <summary>
+        /// The style instance applied to this view.
+        /// Note that please do not modify the ViewStyle.
+        /// Modifying ViewStyle will affect other views with same ViewStyle.
+        /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public ViewStyle ViewStyle
+        protected ViewStyle ViewStyle
         {
             get
             {
@@ -2673,11 +2677,29 @@ namespace Tizen.NUI.BaseComponents
             UpdateStyle();
         }
 
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        private bool IsViewPropertyDirty(BindableProperty styleProperty)
+        {
+            if (dirtyPropertySet.Count == 0)
+            {
+                return false;
+            }
+
+            if (styleProperty.ReturnType.IsGenericType && styleProperty.ReturnType.GetGenericTypeDefinition() == typeof(Selector<>))
+            {
+                return dirtyPropertySet.Contains(styleProperty.PropertyName.Substring(0, styleProperty.PropertyName.Length - 8));
+            }
+
+            return dirtyPropertySet.Contains(styleProperty.PropertyName);
+        }
+
+        /// <summary>
+        /// Apply style instance to the view.
+        /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
+        /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public virtual void ApplyStyle(ViewStyle viewStyle)
         {
-            if (null == viewStyle || this.viewStyle == viewStyle) return;
+            if (viewStyle == null || this.viewStyle == viewStyle) return;
 
             this.viewStyle = viewStyle;
 
@@ -2687,6 +2709,11 @@ namespace Tizen.NUI.BaseComponents
                 return;
             }
 
+            if (dirtyPropertySet == null)
+            {
+                dirtyPropertySet = new HashSet<string>();
+            }
+
             BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
 
             if (bindablePropertyOfView == null)
@@ -2694,11 +2721,17 @@ namespace Tizen.NUI.BaseComponents
                 return;
             }
 
-            var dirtyProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
-            viewStyle.DirtyProperties.CopyTo(dirtyProperties);
+            var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
+            viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
 
-            foreach (var sourceProperty in dirtyProperties)
+            foreach (var sourceProperty in dirtyStyleProperties)
             {
+                if (blockSetDirty && IsViewPropertyDirty(sourceProperty))
+                {
+                    // Skip applying theme style for a property set by user.
+                    continue;
+                }
+
                 var sourceValue = viewStyle.GetValue(sourceProperty);
 
                 if (sourceValue == null)
index 95ab940..9df410d 100755 (executable)
@@ -16,7 +16,9 @@
  */
 
 using System;
+using System.Collections.Generic;
 using System.ComponentModel;
+using System.Runtime.CompilerServices;
 
 namespace Tizen.NUI.BaseComponents
 {
@@ -26,7 +28,9 @@ namespace Tizen.NUI.BaseComponents
     /// <since_tizen> 3 </since_tizen>
     public partial class View
     {
+        private static bool blockSetDirty = false;
         private ViewSelectorData selectorData;
+        private HashSet<string> dirtyPropertySet;
 
         internal string styleName;
 
@@ -1077,15 +1081,6 @@ namespace Tizen.NUI.BaseComponents
             shadow.Dispose();
         }
 
-        internal void UpdateStyle()
-        {
-            ViewStyle newStyle;
-            if (styleName == null) newStyle = ThemeManager.GetStyle(GetType());
-            else newStyle = ThemeManager.GetStyle(styleName);
-
-            if (newStyle != null && (viewStyle == null || viewStyle.GetType() == newStyle.GetType())) ApplyStyle(newStyle);
-        }
-
         /// <summary>
         /// Get selector value from the triggerable selector or related property.
         /// </summary>
@@ -1178,6 +1173,21 @@ namespace Tizen.NUI.BaseComponents
             return false;
         }
 
+        /// <summary>
+        /// Call this method from a child class to notify that a change happened on a property.
+        /// </summary>
+        /// <param name="propertyName">The name of the property that changed.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
+        {
+            base.OnPropertyChanged(propertyName);
+
+            if (!blockSetDirty)
+            {
+                dirtyPropertySet?.Add(propertyName);
+            }
+        }
+
         private void DisConnectFromSignals()
         {
             // Save current CPtr.
@@ -1316,6 +1326,16 @@ namespace Tizen.NUI.BaseComponents
             SwigCPtr = currentCPtr;
         }
 
+        /// <summary>
+        /// Apply initial style to the view.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected void InitializeStyle(ViewStyle style = null)
+        {
+            if (style != null) ApplyStyle(style); // Use given style
+            else UpdateStyle(); // Use style in the current theme
+        }
+
         private View ConvertIdToView(uint id)
         {
             View view = GetParent()?.FindCurrentChildById(id);
@@ -1393,10 +1413,18 @@ namespace Tizen.NUI.BaseComponents
             return false;
         }
 
-        private void InitializeStyle(ViewStyle style)
+        private void UpdateStyle()
         {
-            if (style != null) ApplyStyle(style.Clone());   // Use given style
-            else if (ThemeManager.ThemeApplied) UpdateStyle(); // Use style in the current theme
+            ViewStyle newStyle;
+            if (string.IsNullOrEmpty(styleName)) newStyle = ThemeManager.GetStyleWithoutClone(GetType());
+            else newStyle = ThemeManager.GetStyleWithoutClone(styleName);
+
+            if (newStyle != null)
+            {
+                blockSetDirty = true;
+                ApplyStyle(newStyle);
+                blockSetDirty = false;
+            }
         }
 
         private ViewSelectorData EnsureSelectorData() => selectorData ?? (selectorData = new ViewSelectorData());
index 500f05a..5192c67 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -27,7 +27,7 @@ namespace Tizen.NUI
     {
         internal ViewWrapperImpl viewWrapperImpl;
 
-        internal ViewWrapper(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn, null)
+        internal ViewWrapper(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
         {
         }
 
@@ -37,12 +37,6 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal ViewWrapper(string typeName, ViewWrapperImpl implementation, ViewStyle viewStyle) : base(Interop.ViewWrapper.New(typeName, ViewWrapperImpl.getCPtr(implementation)), true, viewStyle)
-        {
-            viewWrapperImpl = implementation;
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
         /// This will not be public opened.
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
index d5e866d..ca667fa 100755 (executable)
@@ -121,7 +121,7 @@ namespace Tizen.NUI
                         var baseStyle = item.Value?.Clone();
                         if (map.ContainsKey(item.Key))
                         {
-                            baseStyle.Merge(map[item.Key]);
+                            baseStyle.MergeDirectly(map[item.Key]);
                         }
                         map[item.Key] = baseStyle;
                     }
@@ -181,7 +181,7 @@ namespace Tizen.NUI
 
                 if (map.TryGetValue(styleName, out ViewStyle style) && style != null && style.GetType() == value.GetType())
                 {
-                    style.Merge(value);
+                    style.MergeDirectly(value);
                 }
                 else
                 {
@@ -311,7 +311,7 @@ namespace Tizen.NUI
                 }
                 else if (map.ContainsKey(item.Key) && !item.Value.SolidNull)
                 {
-                    map[item.Key].Merge(item.Value);
+                    map[item.Key].MergeDirectly(item.Value);
                 }
                 else
                 {
@@ -343,7 +343,7 @@ namespace Tizen.NUI
                 }
                 else if (map.ContainsKey(item.Key) && !item.Value.SolidNull)
                 {
-                    map[item.Key].Merge(item.Value);
+                    map[item.Key].MergeDirectly(item.Value);
                 }
                 else
                 {
index 5480b67..b1e229e 100755 (executable)
@@ -75,7 +75,7 @@ namespace Tizen.NUI
             }
         }
 
-        internal static bool ThemeApplied => defaultTheme.Count > 0 || (currentTheme != null && currentTheme.Count > 0);
+        private static bool ThemeApplied => defaultTheme.Count > 0 || (currentTheme != null && currentTheme.Count > 0);
 
         /// <summary>
         /// Apply theme to the NUI.
@@ -114,7 +114,8 @@ namespace Tizen.NUI
 
             if (theme != null)
             {
-                CurrentTheme = theme;
+                defaultTheme = theme;
+                NotifyThemeChanged();
                 return true;
             }
 
@@ -133,10 +134,7 @@ namespace Tizen.NUI
         public static ViewStyle GetStyle(string styleName)
         {
             if (styleName == null) throw new ArgumentNullException(nameof(styleName));
-
-            if (!ThemeApplied) return null;
-
-            return (currentTheme?.GetStyle(styleName) ?? defaultTheme.GetStyle(styleName))?.Clone();
+            return GetStyleWithoutClone(styleName)?.Clone();
         }
 
         /// <summary>
@@ -148,10 +146,31 @@ namespace Tizen.NUI
         public static ViewStyle GetStyle(Type viewType)
         {
             if (viewType == null) throw new ArgumentNullException(nameof(viewType));
+            return GetStyleWithoutClone(viewType)?.Clone();
+        }
 
+        /// <summary>
+        /// Load a style with style name in the current theme.
+        /// </summary>
+        /// <param name="styleName">The style name.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        internal static ViewStyle GetStyleWithoutClone(string styleName)
+        {
+            if (!ThemeApplied) return null;
+
+            return currentTheme?.GetStyle(styleName) ?? defaultTheme.GetStyle(styleName);
+        }
+
+        /// <summary>
+        /// Load a style with View type in the current theme.
+        /// </summary>
+        /// <param name="viewType">The type of View.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        internal static ViewStyle GetStyleWithoutClone(Type viewType)
+        {
             if (!ThemeApplied) return null;
 
-            return (currentTheme?.GetStyle(viewType) ?? defaultTheme.GetStyle(viewType))?.Clone();
+            return currentTheme?.GetStyle(viewType) ?? defaultTheme.GetStyle(viewType);
         }
 
         /// <summary>