diff options
author | WonYoung Choi <wy80.choi@samsung.com> | 2017-02-15 19:23:23 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-03-24 13:19:02 +0900 |
commit | 5f2706e4c098da7cb2af87540d30334beae78a83 (patch) | |
tree | 5224ec1a88469b2b10907db563a320d04dda98f9 | |
parent | bb5066c364f07302b087bbe8a38ce38f4d4588e4 (diff) | |
download | xamarin-forms-5f2706e4c098da7cb2af87540d30334beae78a83.tar.gz xamarin-forms-5f2706e4c098da7cb2af87540d30334beae78a83.tar.bz2 xamarin-forms-5f2706e4c098da7cb2af87540d30334beae78a83.zip |
Add TabbedPageStyle
Add two styles of TabbedPage, "Tabbar", "TabbarWithTitle"
Change-Id: I71d3e7c128b03b5df58a0ab9f9929b24ac9e4650
-rw-r--r-- | Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/StyleValues.cs | 7 | ||||
-rw-r--r--[-rwxr-xr-x] | Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs | 27 |
2 files changed, 18 insertions, 16 deletions
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 index dd8c44cd..bec57fe9 100755..100644 --- 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<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) { |