[NUI] Provide APIs to access sub-components (#1624)
authorzhouleonlei <56956725+zhouleonlei@users.noreply.github.com>
Thu, 28 May 2020 08:18:01 +0000 (16:18 +0800)
committerGitHub <noreply@github.com>
Thu, 28 May 2020 08:18:01 +0000 (17:18 +0900)
* [NUI] Provide APIs to access sub-components

* [NUI] Modified Slider API name

* [NUI] Add internal setter

* [NUI] Removed unused Apis

* [NUI] Rebase Scrollbar

src/Tizen.NUI.Components/Controls/Button.cs
src/Tizen.NUI.Components/Controls/DropDown.cs
src/Tizen.NUI.Components/Controls/Popup.cs
src/Tizen.NUI.Components/Controls/ScrollbarBase.cs [changed mode: 0644->0755]
src/Tizen.NUI.Components/Controls/Slider.cs
src/Tizen.NUI.Components/Controls/Switch.cs
src/Tizen.NUI.Components/Controls/Tab.cs

index b3ef588..f52cf41 100755 (executable)
@@ -122,6 +122,10 @@ namespace Tizen.NUI.Components
             return instance.Style?.TextPadding;
         });
 
+        private ImageView overlayImage;
+        private TextLabel buttonText;
+        private ImageView buttonIcon;
+
         private EventHandler<StateChangedEventArgs> stateChangeHander;
 
         private bool isSelected = false;
@@ -129,24 +133,6 @@ namespace Tizen.NUI.Components
         private bool isPressed = false;
 
         /// <summary>
-        /// Button's overlay image part.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected ImageView ButtonOverlayImage { get; set; }
-
-        /// <summary>
-        /// Button's text part.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected TextLabel ButtonText { get; set; }
-
-        /// <summary>
-        /// Button's icon part.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected ImageView ButtonIcon { get; set; }
-
-        /// <summary>
         /// The last touch information triggering selected state change.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -277,8 +263,92 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// Style of the button.
+        /// Button's icon part.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public ImageView ButtonIcon
+        {
+            get
+            {
+                if (null == buttonIcon)
+                {
+                    buttonIcon = CreateIcon();
+                    if (null != Extension)
+                    {
+                        buttonIcon = Extension.OnCreateIcon(this, buttonIcon);
+                    }
+                    Add(buttonIcon);
+                    buttonIcon.Relayout += OnIconRelayout;
+                }
+                return buttonIcon;
+            }
+            internal set
+            {
+                buttonIcon = value;
+            }
+        }
+
+        /// <summary>
+        /// Button's overlay image part.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public ImageView ButtonOverlay
+        {
+            get
+            {
+                if (null == overlayImage)
+                {
+                    overlayImage = CreateOverlayImage();
+                    if (null != Extension)
+                    {
+                        overlayImage = Extension.OnCreateOverlayImage(this, overlayImage);
+                    }
+                    overlayImage.WidthResizePolicy = ResizePolicyType.FillToParent;
+                    overlayImage.HeightResizePolicy = ResizePolicyType.FillToParent;
+                    Add(overlayImage);
+                }
+                return overlayImage;
+            }
+            internal set
+            {
+                overlayImage = value;
+            }
+        }
+
+        /// <summary>
+        /// Button's text part.
         /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public TextLabel ButtonText
+        {
+            get
+            {
+                if (null == buttonText)
+                {
+                    buttonText = CreateText();
+                    if (null != Extension)
+                    {
+                        buttonText = Extension.OnCreateText(this, buttonText);
+                    }
+                    buttonText.HorizontalAlignment = HorizontalAlignment.Center;
+                    buttonText.VerticalAlignment = VerticalAlignment.Center;
+                    Add(buttonText);
+                }
+                return buttonText;
+            }
+            internal set
+            {
+                buttonText = value;
+            }
+        }
+
+        /// <summary>
+        /// Return a copied Style instance of Button
+        /// </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)
+        /// </remarks>
         /// <since_tizen> 8 </since_tizen>
         public new ButtonStyle Style => ViewStyle as ButtonStyle;
 
@@ -699,9 +769,9 @@ namespace Tizen.NUI.Components
                 {
                     Utility.Dispose(ButtonText);
                 }
-                if (ButtonOverlayImage != null)
+                if (ButtonOverlay != null)
                 {
-                    Utility.Dispose(ButtonOverlayImage);
+                    Utility.Dispose(ButtonOverlay);
                 }
             }
 
@@ -841,12 +911,23 @@ namespace Tizen.NUI.Components
             base.ApplyStyle(viewStyle);
 
             ButtonStyle buttonStyle = viewStyle as ButtonStyle;
-
             if (null != buttonStyle)
             {
-                ButtonOverlayImage?.ApplyStyle(buttonStyle.Overlay);
-                ButtonText?.ApplyStyle(buttonStyle.Text);
-                ButtonIcon?.ApplyStyle(buttonStyle.Icon);
+                Extension = buttonStyle.CreateExtension();
+                if (buttonStyle.Overlay != null)
+                {
+                    ButtonOverlay?.ApplyStyle(buttonStyle.Overlay);
+                }
+
+                if (buttonStyle.Text != null)
+                {
+                    ButtonText?.ApplyStyle(buttonStyle.Text);
+                }
+
+                if (buttonStyle.Icon != null)
+                {
+                    ButtonIcon?.ApplyStyle(buttonStyle.Icon);
+                }
             }
         }
 
@@ -934,54 +1015,11 @@ namespace Tizen.NUI.Components
         private void Initialize()
         {
             var style = (ButtonStyle)Style;
-
-            Extension = style.CreateExtension();
-
-            CreateComponents();
-
             EnableControlStatePropagation = true;
-
-            if (ButtonOverlayImage != null)
-            {
-                Add(ButtonOverlayImage);
-                ButtonOverlayImage.ApplyStyle(style.Overlay);
-            }
-
-            if (ButtonIcon != null)
-            {
-                Add(ButtonIcon);
-                ButtonIcon.ApplyStyle(style.Icon);
-                ButtonIcon.Relayout += OnIconRelayout;
-            }
-
-            if (null != ButtonText)
-            {
-                Add(ButtonText);
-                ButtonText.ApplyStyle(style.Text);
-            }
-
             UpdateState();
-
             LayoutDirectionChanged += OnLayoutDirectionChanged;
         }
 
-        private void CreateComponents()
-        {
-            ButtonOverlayImage = CreateOverlayImage();
-            ButtonIcon = CreateIcon();
-            ButtonText = CreateText();
-
-            if (Extension == null)
-            {
-                return;
-            }
-
-            // Update component with extension
-            ButtonOverlayImage = Extension.OnCreateOverlayImage(this, ButtonOverlayImage);
-            ButtonIcon = Extension.OnCreateIcon(this, ButtonIcon);
-            ButtonText = Extension.OnCreateText(this, ButtonText);
-        }
-
         /// <summary>
         /// Measure text, it can be override.
         /// </summary>
@@ -1232,7 +1270,7 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public ImageView GetCurrentOverlayImage(ButtonExtension extension)
         {
-            return (extension == Extension) ? ButtonOverlayImage : null;
+            return (extension == Extension) ? ButtonOverlay : null;
         }
     }
 }
index 1603c3c..20a6573 100755 (executable)
@@ -205,8 +205,125 @@ namespace Tizen.NUI.Components
             Right,
         }
 
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <summary>
+        /// Get or set header text.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public TextLabel HeaderText
+        {
+            get
+            {
+                if (null == headerText)
+                {
+                    headerText = new TextLabel()
+                    {
+                        WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+                        HeightResizePolicy = ResizePolicyType.UseNaturalSize,
+                        HorizontalAlignment = HorizontalAlignment.Center,
+                        VerticalAlignment = VerticalAlignment.Center,
+                        ParentOrigin = NUI.ParentOrigin.Center,
+                        PivotPoint = NUI.ParentOrigin.Center,
+                        PositionUsesPivotPoint = true,
+                        Name = "DropDownHeaderText"
+                    };
+                    Add(headerText);
+                }
+                return headerText;
+            }
+            internal set
+            {
+                headerText = value;
+            }
+        }
+
+        /// <summary>
+        /// Get or set button.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
+        public Button Button
+        {
+            get
+            {
+                if (null == button)
+                {
+                    button = new Button()
+                    {
+                        ParentOrigin = NUI.ParentOrigin.CenterLeft,
+                        PivotPoint = NUI.PivotPoint.CenterLeft,
+                        PositionUsesPivotPoint = true,
+                        HeightResizePolicy = ResizePolicyType.FitToChildren,
+                        IconRelativeOrientation = Button.IconOrientation.Right,
+                        Name = "DropDownButton"
+                    };
+                    button.ClickEvent += ButtonClickEvent;
+                    Add(button);
+
+                    if (null == buttonText)
+                    {
+                        buttonText = new TextLabel();
+                    }
+                }
+                return button;
+            }
+            internal set
+            {
+                button = value;
+            }
+        }
+
+        /// <summary>
+        /// Get or set the background image of list.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public ImageView ListBackgroundImage
+        {
+            get
+            {
+                if (null == listBackgroundImage)
+                {
+                    listBackgroundImage = new ImageView()
+                    {
+                        Name = "ListBackgroundImage",
+                        PositionUsesPivotPoint = true,
+                        ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+                        PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+                        WidthResizePolicy = ResizePolicyType.FitToChildren,
+                        HeightResizePolicy = ResizePolicyType.FitToChildren,
+                    };
+                    Add(listBackgroundImage);
+
+                    if (null == scrollableBase) // scrollableBase used to test of ListContainer Setup invoked already
+                    {
+                        SetUpListContainer();
+                    }
+                }
+                return listBackgroundImage;
+            }
+            internal set
+            {
+                listBackgroundImage = value;
+            }
+        }
+
+        /// <summary>
+        /// Return a copied Style instance of DropDown
+        /// </summary>
+        /// <remarks>
+        /// It returns copied Style instance and changing it does not effect to the DropDown.
+        /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
+        /// </remarks>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        //public new DropDownStyle Style
+        //{
+        //    get
+        //    {
+        //        return new DropDownStyle(ViewStyle as DropDownStyle);
+        //    }
+        //}
         public new DropDownStyle Style => ViewStyle as DropDownStyle;
 
         /// <summary>
@@ -384,18 +501,18 @@ namespace Tizen.NUI.Components
             DropDownStyle dropDownStyle = viewStyle as DropDownStyle;
             if (null != dropDownStyle)
             {
-                CreateHeaderText();
-                CreateButtonText();
-                CreateButton();
-
-                CreateListBackgroundImage();
-                if (null == scrollableBase) // scrollableBase used to test of ListContainer Setup invoked already
+                if (null != dropDownStyle.Button)
                 {
-                    SetUpListContainer();
+                    Button.ApplyStyle(dropDownStyle.Button);
+                }
+                if (null != dropDownStyle.HeaderText)
+                {
+                    HeaderText.ApplyStyle(dropDownStyle.HeaderText);
+                }
+                if (null != dropDownStyle.ListBackgroundImage)
+                {
+                    ListBackgroundImage.ApplyStyle(dropDownStyle.ListBackgroundImage);
                 }
-                button.ApplyStyle(dropDownStyle.Button);
-                headerText.ApplyStyle(dropDownStyle.HeaderText);
-                listBackgroundImage.ApplyStyle(dropDownStyle.ListBackgroundImage);
                 UpdateDropDown();
             }
         }
@@ -527,25 +644,6 @@ namespace Tizen.NUI.Components
             ItemClickEvent?.Invoke(sender, e);
         }
 
-        private void CreateHeaderText()
-        {
-            if (null == headerText)
-            {
-                headerText = new TextLabel()
-                {
-                    WidthResizePolicy = ResizePolicyType.UseNaturalSize,
-                    HeightResizePolicy = ResizePolicyType.UseNaturalSize,
-                    HorizontalAlignment = HorizontalAlignment.Center,
-                    VerticalAlignment = VerticalAlignment.Center,
-                    ParentOrigin = NUI.ParentOrigin.Center,
-                    PivotPoint = NUI.ParentOrigin.Center,
-                    PositionUsesPivotPoint = true,
-                };
-                headerText.Name = "DropDownHeaderText";
-                Add(headerText);
-            }
-        }
-
         private void CreateButtonText()
         {
             if (null == buttonText)
@@ -572,23 +670,6 @@ namespace Tizen.NUI.Components
             }
         }
 
-        private void CreateListBackgroundImage()
-        {
-            if (null == listBackgroundImage)
-            {
-                listBackgroundImage = new ImageView
-                {
-                    Name = "ListBackgroundImage",
-                    PositionUsesPivotPoint = true,
-                    ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
-                    PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
-                    WidthResizePolicy = ResizePolicyType.FitToChildren,
-                    HeightResizePolicy = ResizePolicyType.FitToChildren,
-                };
-                Add(listBackgroundImage);
-            }
-        }
-
         private void SetUpListContainer()
         {
             LinearLayout linear = new LinearLayout()
index ef74941..629dd21 100755 (executable)
@@ -334,6 +334,27 @@ namespace Tizen.NUI.Components
         public new PopupStyle Style => ViewStyle as PopupStyle;
 
         /// <summary>
+        /// Popup Title.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public TextLabel Title
+        {
+            get
+            {
+                if (null == titleText)
+                {
+                    titleText = new TextLabel();
+                    Add(titleText);
+                }
+                return titleText;
+            }
+            internal set
+            {
+                titleText = value;
+            }
+        }
+
+        /// <summary>
         /// Title text string in Popup.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
@@ -693,13 +714,8 @@ namespace Tizen.NUI.Components
             PopupStyle ppStyle = viewStyle as PopupStyle;
             if (null != ppStyle)
             {
-                if (null == titleText)
-                {
-                    titleText = new TextLabel();
-                    Add(titleText);
-                }
-                titleText.RaiseToTop();
-                titleText.ApplyStyle(ppStyle.Title);
+                Title.ApplyStyle(ppStyle.Title);
+                Title.RaiseToTop();
             }
         }
 
@@ -750,14 +766,6 @@ namespace Tizen.NUI.Components
             Add(ContentView);
             ContentView.RaiseToTop();
 
-            // Title
-            if (null == titleText)
-            {
-                titleText = new TextLabel();
-                titleText.RaiseToTop();
-                Add(titleText);
-            }
-
             // Button
             btGroup = new ButtonGroup(this);
         }
index 76733e6..53d835b 100755 (executable)
@@ -271,6 +271,38 @@ namespace Tizen.NUI.Components
         public new SliderStyle Style => ViewStyle as SliderStyle;
 
         /// <summary>
+        /// Get or set low indicator text.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public TextLabel LowIndicatorText
+        {
+            get
+            {
+                return CreateLowIndicatorText();
+            }
+            internal set
+            {
+                lowIndicatorText = value;
+            }
+        }
+
+        /// <summary>
+        /// Get or set high indicator text.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public TextLabel HighIndicatorText
+        {
+            get
+            {
+                return CreateHighIndicatorText();
+            }
+            internal set
+            {
+                highIndicatorText = value;
+            }
+        }
+
+        /// <summary>
         /// Gets or sets the direction type of slider.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
@@ -827,27 +859,27 @@ namespace Tizen.NUI.Components
 
             if (null != sliderStyle?.Progress)
             {
-                CreateSlidedTrack();
+                CreateSlidedTrack().ApplyStyle(sliderStyle.Progress);
             }
 
             if (null != sliderStyle?.LowIndicator)
             {
-                CreateLowIndicatorText();
+                CreateLowIndicatorText().ApplyStyle(sliderStyle.LowIndicator);
             }
 
             if (null != sliderStyle?.HighIndicator)
             {
-                CreateHighIndicatorText();
+                CreateHighIndicatorText().ApplyStyle(sliderStyle.HighIndicator);
             }
 
             if (null != sliderStyle?.Track)
             {
-                CreateBackgroundTrack();
+                CreateBackgroundTrack().ApplyStyle(sliderStyle.Track);
             }
 
             if (null != sliderStyle?.Thumb)
             {
-                CreateThumb();
+                CreateThumb().ApplyStyle(sliderStyle.Thumb);
             }
 
             EnableControlStatePropagation = true;
@@ -866,7 +898,7 @@ namespace Tizen.NUI.Components
             RelayoutRequest();
         }
 
-        private void CreateSlidedTrack()
+        private ImageView CreateSlidedTrack()
         {
             if (null == slidedTrackImage)
             {
@@ -887,15 +919,10 @@ namespace Tizen.NUI.Components
                 }
             }
 
-            if (null == Style.Progress)
-            {
-                Style.Progress = new ImageViewStyle();
-            }
-
-            slidedTrackImage.ApplyStyle(Style.Progress);
+            return slidedTrackImage;
         }
 
-        private void CreateLowIndicatorText()
+        private TextLabel CreateLowIndicatorText()
         {
             if (null == lowIndicatorText)
             {
@@ -907,15 +934,10 @@ namespace Tizen.NUI.Components
                 this.Add(lowIndicatorText);
             }
 
-            if (null == Style.LowIndicator)
-            {
-                Style.LowIndicator = new TextLabelStyle();
-            }
-
-            lowIndicatorText.ApplyStyle(Style.LowIndicator);
+            return lowIndicatorText;
         }
 
-        private void CreateHighIndicatorText()
+        private TextLabel CreateHighIndicatorText()
         {
             if (null == highIndicatorText)
             {
@@ -927,15 +949,10 @@ namespace Tizen.NUI.Components
                 this.Add(highIndicatorText);
             }
 
-            if (null == Style.HighIndicator)
-            {
-                Style.HighIndicator = new TextLabelStyle();
-            }
-
-            highIndicatorText.ApplyStyle(Style.HighIndicator);
+            return highIndicatorText;
         }
 
-        private void CreateBackgroundTrack()
+        private ImageView CreateBackgroundTrack()
         {
             if (null == bgTrackImage)
             {
@@ -957,15 +974,10 @@ namespace Tizen.NUI.Components
                 bgTrackImage.TouchEvent += OnTouchEventForBgTrack;
             }
 
-            if (null == Style.Track)
-            {
-                Style.Track = new ImageViewStyle();
-            }
-
-            bgTrackImage.ApplyStyle(Style.Track);
+            return bgTrackImage;
         }
 
-        private void CreateThumb()
+        private ImageView CreateThumb()
         {
             if (null == thumbImage)
             {
@@ -988,12 +1000,7 @@ namespace Tizen.NUI.Components
                 panGestureDetector.Detected += OnPanGestureDetected;
             }
 
-            if (null == Style.Thumb)
-            {
-                Style.Thumb= new ImageViewStyle();
-            }
-
-            thumbImage.ApplyStyle(Style.Thumb);
+            return thumbImage;
         }
 
         private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
index ee02ac5..e9d7408 100755 (executable)
@@ -28,6 +28,9 @@ namespace Tizen.NUI.Components
     /// <since_tizen> 6 </since_tizen>
     public class Switch : Button
     {
+        private ImageView track = null;
+        private ImageView thumb = null;
+
         static Switch() { }
 
         /// <summary>
@@ -72,7 +75,100 @@ namespace Tizen.NUI.Components
         public new SwitchStyle Style => ViewStyle as SwitchStyle;
 
         /// <summary>
-        /// Background image's resource url in Switch.
+        /// Apply style to switch.
+        /// </summary>
+        /// <param name="viewStyle">The style to apply.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void ApplyStyle(ViewStyle viewStyle)
+        {
+            base.ApplyStyle(viewStyle);
+
+            SwitchStyle swStyle = viewStyle as SwitchStyle;
+
+            if (null != swStyle)
+            {
+                if (swStyle.Track != null)
+                {
+                    Track.ApplyStyle(swStyle.Track);
+                }
+
+                if (swStyle.Thumb != null)
+                {
+                    Thumb.ApplyStyle(swStyle.Thumb);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Switch's track part.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public ImageView Track
+        {
+            get
+            {
+                if (track == null)
+                {
+                    track = new ImageView()
+                    {
+                        PositionUsesPivotPoint = true,
+                        ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft,
+                        PivotPoint = Tizen.NUI.PivotPoint.CenterLeft,
+                        WidthResizePolicy = ResizePolicyType.FillToParent,
+                        HeightResizePolicy = ResizePolicyType.FillToParent
+                    };
+
+                    var extension = (SwitchExtension)Extension;
+                    if (extension != null)
+                    {
+                        track = extension.OnCreateTrack(this, track);
+                    }
+                    Add(track);
+                }
+                return track;
+            }
+            internal set
+            {
+                track = value;
+            }
+        }
+
+        /// <summary>
+        /// Switch's thumb part.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public ImageView Thumb
+        {
+            get
+            {
+                if (thumb == null)
+                {
+                    thumb = new ImageView()
+                    {
+                        PositionUsesPivotPoint = true,
+                        ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft,
+                        PivotPoint = Tizen.NUI.PivotPoint.CenterLeft,
+                        WidthResizePolicy = ResizePolicyType.Fixed,
+                        HeightResizePolicy = ResizePolicyType.Fixed
+                    };
+
+                    var extension = (SwitchExtension)Extension;
+                    if (extension != null)
+                    {
+                        thumb = extension.OnCreateThumb(this, thumb);
+                    }
+                    Add(thumb);
+                }
+                return thumb;
+            }
+            internal set
+            {
+                thumb = value;
+            }
+        }
+
+        /// <summary>
+        /// Switch's track part.
         /// </summary>
         /// <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.
@@ -173,38 +269,6 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// Switch's track part.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected ImageView Track { get; set; }
-
-        /// <summary>
-        /// Switch's thumb part.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected ImageView Thumb { get; set; }
-
-        /// <summary>
-        /// Creates Switch's track part.
-        /// </summary>
-        /// <return>The created Button's icon part.</return>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected virtual ImageView CreateTrack()
-        {
-            return new ImageView();
-        }
-
-        /// <summary>
-        /// Creates Switch's overlay thumb part.
-        /// </summary>
-        /// <return>The created Button's overlay image part.</return>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected virtual ImageView CreateThumb()
-        {
-            return new ImageView();
-        }
-
-        /// <summary>
         /// Dispose Switch and all children on it.
         /// </summary>
         /// <param name="type">Dispose type.</param>
@@ -285,36 +349,6 @@ namespace Tizen.NUI.Components
         private void Initialize()
         {
             Style.IsSelectable = true;
-
-            CreateComponents();
-
-            if (null != Track)
-            {
-                Add(Track);
-                Track.ApplyStyle(Style.Track);
-            }
-
-            if (null != Thumb)
-            {
-                Add(Thumb);
-                Thumb.ApplyStyle(Style.Thumb);
-            }
-        }
-
-        private void CreateComponents()
-        {
-            Track = CreateTrack();
-            Thumb = CreateThumb();
-
-            if (Extension as SwitchExtension == null)
-            {
-                return;
-            }
-
-            // Update component with extension
-            var extension = (SwitchExtension)Extension;
-            Track = extension.OnCreateTrack(this, Track);
-            Thumb = extension.OnCreateThumb(this, Thumb);
         }
 
         /// <summary>
index 0cb441e..5d50844 100755 (executable)
@@ -78,6 +78,29 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public new TabStyle Style => ViewStyle as TabStyle;
 
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public View Underline
+        {
+            get
+            {
+                if (null == underline)
+                {
+                    underline = new View()
+                    {
+                        PositionUsesPivotPoint = true,
+                        ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
+                        PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+                    };
+                    Add(underline);
+                }
+                return underline;
+            }
+            internal set
+            {
+                underline = value;
+            }
+        }
+
         /// <summary>
         /// Selected item's index in Tab.
         /// </summary>
@@ -371,19 +394,8 @@ namespace Tizen.NUI.Components
 
             if (null != tabStyle)
             {
-                if (null == underline)
-                {
-                    underline = new View()
-                    {
-                        PositionUsesPivotPoint = true,
-                        ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
-                        PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
-                    };
-                    Add(underline);
-                    CreateUnderLineAnimation();
-                }
-
-                underline.ApplyStyle(Style.UnderLine);
+                Underline.ApplyStyle(tabStyle.UnderLine);
+                CreateUnderLineAnimation();
             }
         }