Add TabbedPageStyle
authorWonYoung Choi <wy80.choi@samsung.com>
Wed, 15 Feb 2017 10:23:23 +0000 (19:23 +0900)
committerKangho Hur <kangho.hur@samsung.com>
Mon, 24 Apr 2017 04:36:54 +0000 (13:36 +0900)
Add two styles of TabbedPage, "Tabbar", "TabbarWithTitle"

Change-Id: I71d3e7c128b03b5df58a0ab9f9929b24ac9e4650

Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/StyleValues.cs
Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs [changed mode: 0755->0644]

index d4e3c3f..2d5ea5b 100644 (file)
@@ -19,4 +19,11 @@ namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
                public const string Default = "default";
                public const string Pending = "pending";
        }
+
+       public static class TabbedPageStyle
+       {
+               public const string Default = "default";
+               public const string Tabbar = "tabbar";
+               public const string TabbarWithTitle = "tabbar_with_title";
+       }
 }
old mode 100755 (executable)
new mode 100644 (file)
index dd8c44c..bec57fe
@@ -5,6 +5,8 @@ using ElmSharp;
 using EToolbarItem = ElmSharp.ToolbarItem;
 using EToolbarItemEventArgs = ElmSharp.ToolbarItemEventArgs;
 
+using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
+
 namespace Xamarin.Forms.Platform.Tizen
 {
        public class TabbedPageRenderer : VisualElementRenderer<TabbedPage>, IVisualElementRenderer
@@ -14,7 +16,7 @@ namespace Xamarin.Forms.Platform.Tizen
                EvasObject _tcontent;
                Dictionary<EToolbarItem, Page> _itemToItemPage = new Dictionary<EToolbarItem, Page>();
 
-               public TabbedPageRenderer ()
+               public TabbedPageRenderer()
                {
                        //Register for title change property
                        RegisterPropertyHandler(TabbedPage.TitleProperty, UpdateTitle);
@@ -81,6 +83,12 @@ namespace Xamarin.Forms.Platform.Tizen
                        base.OnElementReady();
                }
 
+               protected override void UpdateThemeStyle()
+               {
+                       _tpage.Style = Element.OnThisPlatform().GetStyle();
+                       ((IVisualElementController)Element).NativeSizeChanged();
+               }
+
                void UpdateTitle()
                {
                        _tpage.Text = Element.Title;
@@ -106,7 +114,6 @@ namespace Xamarin.Forms.Platform.Tizen
                void FillToolbar()
                {
                        var logicalChildren = (Element as IElementController).LogicalChildren;
-                       bool hasIcon = false;
 
                        //add items to toolbar
                        foreach (Page child in logicalChildren)
@@ -117,20 +124,8 @@ namespace Xamarin.Forms.Platform.Tizen
                                        childRenderer.NativeView.Hide();
                                }
 
-                               EToolbarItem toolbarItem;
-                               if (string.IsNullOrEmpty(child.Icon))
-                               {
-                                       toolbarItem = _tpage.Append(child.Title);
-                               }
-                               else
-                               {
-                                       if (!hasIcon)
-                                       {
-                                               _tpage.Style="tabbar";
-                                               hasIcon = true;
-                                       }
-                                       toolbarItem = _tpage.Append(child.Title, ResourcePath.GetPath(child.Icon));
-                               }
+                               EToolbarItem toolbarItem = _tpage.Append(child.Title, string.IsNullOrEmpty(child.Icon) ? null : ResourcePath.GetPath(child.Icon));
+
                                _itemToItemPage.Add(toolbarItem, child);
                                if (Element.CurrentPage == child)
                                {