Apply the style to ToolbarItem's button
authorKangho Hur <kangho.hur@samsung.com>
Wed, 25 Jan 2017 00:54:14 +0000 (09:54 +0900)
committerKangho Hur <kangho.hur@samsung.com>
Mon, 24 Apr 2017 04:36:52 +0000 (13:36 +0900)
TASK=TNET-651

- Applying the button style to toolbar item's (internal) button in case of toolbar item has only text.

Change-Id: I6ea87ffbc4de28bc1bbd29d11f406bd0da1c6a5b

Xamarin.Forms.Platform.Tizen/Renderers/NavigationPageRenderer.cs

index 42ca074..c386d48 100644 (file)
@@ -16,6 +16,8 @@ namespace Xamarin.Forms.Platform.Tizen
                const string _partBackButton = "elm.swallow.prev_btn";
                const string _leftToolbar = "title_left_btn";
                const string _rightToolbar = "title_right_btn";
+               const string _leftToolBarButtonStyle = "naviframe/title_left";
+               const string _rightToolbarButtonStyle = "naviframe/title_right";
                const string _defaultToolbarIcon = "naviframe/drawers";
                const string _partTitle = "default";
                const string _styleBackButton = "naviframe/back_btn/default";
@@ -285,11 +287,27 @@ namespace Xamarin.Forms.Platform.Tizen
                                control.Activate();
                        };
                        button.Text = item.Text;
-                       button.BackgroundColor = Xamarin.Forms.Color.Transparent.ToNative();
+                       button.BackgroundColor = Color.Transparent.ToNative();
 
-                       if (String.IsNullOrEmpty(item.Icon) && String.IsNullOrEmpty(item.Text))
+                       if (string.IsNullOrEmpty(item.Icon))
                        {
-                               button.Style = _defaultToolbarIcon;
+                               if (string.IsNullOrEmpty(item.Text))
+                               {
+                                       // We assumed the default toolbar icon is "naviframe/drawer" if there are no icon and text.
+                                       button.Style = _defaultToolbarIcon;
+                               }
+                               else
+                               {
+                                       if (item.Order == ToolbarItemOrder.Secondary)
+                                       {
+                                               button.Style = _leftToolBarButtonStyle;
+                                       }
+                                       else
+                                       {
+                                               // We assumed both primary or default order as right toolbar button
+                                               button.Style = _rightToolbarButtonStyle;
+                                       }
+                               }
                        }
                        else
                        {