From 6eadf8ab38e8db36032f0b593710aa287aad1f65 Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Wed, 15 Feb 2017 19:23:23 +0900 Subject: Add TabbedPageStyle Add two styles of TabbedPage, "Tabbar", "TabbarWithTitle" Change-Id: I71d3e7c128b03b5df58a0ab9f9929b24ac9e4650 --- .../TizenSpecific/StyleValues.cs | 7 ++++++ .../Renderers/TabbedPageRenderer.cs | 27 +++++++++------------- 2 files changed, 18 insertions(+), 16 deletions(-) mode change 100755 => 100644 Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs diff --git a/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/StyleValues.cs b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/StyleValues.cs index d4e3c3ff..2d5ea5b3 100644 --- a/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/StyleValues.cs +++ b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/StyleValues.cs @@ -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"; + } } diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs old mode 100755 new mode 100644 index dd8c44cd..bec57fe9 --- a/Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs @@ -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, IVisualElementRenderer @@ -14,7 +16,7 @@ namespace Xamarin.Forms.Platform.Tizen EvasObject _tcontent; Dictionary _itemToItemPage = new Dictionary(); - 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) { -- cgit v1.2.3