Fix PickerRender bug
authorKangho Hur <kangho.hur@samsung.com>
Fri, 17 Mar 2017 06:20:29 +0000 (15:20 +0900)
committerKangho Hur <kangho.hur@samsung.com>
Fri, 24 Mar 2017 04:19:03 +0000 (13:19 +0900)
- Picker.TextColor is now available

Change-Id: Idb005c09834672301ec5b465413c9fc1aed79d81

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

index 4508ccf..6080d64 100644 (file)
@@ -1,13 +1,14 @@
-using System;
+using System;
 using System.ComponentModel;
 using System.Collections.Generic;
 using ElmSharp;
-using EButton = ElmSharp.Button;
+using EColor = ElmSharp.Color;
 
 namespace Xamarin.Forms.Platform.Tizen
 {
-       public class PickerRenderer : ViewRenderer<Picker, EButton>
+       public class PickerRenderer : ViewRenderer<Picker, Native.Button>
        {
+               static readonly EColor s_defaultTextColor = EColor.White;
                internal List _list;
                internal Native.Dialog _dialog;
                Dictionary<ListItem, int> _itemToItemNumber = new Dictionary<ListItem, int>();
@@ -20,7 +21,7 @@ namespace Xamarin.Forms.Platform.Tizen
                {
                        if (Control == null)
                        {
-                               var button = new EButton(Forms.Context.MainWindow);
+                               var button = new Native.Button(Forms.Context.MainWindow);
                                SetNativeControl (button);
                        }
 
@@ -32,7 +33,7 @@ namespace Xamarin.Forms.Platform.Tizen
                        if (e.NewElement != null)
                        {
                                UpdateSelectedIndex();
-
+                               UpdateTextColor();
                                Control.Clicked += OnClick;
                        }
 
@@ -47,6 +48,10 @@ namespace Xamarin.Forms.Platform.Tizen
                        {
                                UpdateSelectedIndex();
                        }
+                       else if (e.PropertyName == Picker.TextColorProperty.PropertyName)
+                       {
+                               UpdateTextColor();
+                       }
                }
 
                void UpdateSelectedIndex()
@@ -55,6 +60,11 @@ namespace Xamarin.Forms.Platform.Tizen
                                "" : Element.Items[Element.SelectedIndex]);
                }
 
+               void UpdateTextColor()
+               {
+                       Control.TextColor = Element.TextColor.IsDefault ? s_defaultTextColor : Element.TextColor.ToNative();
+               }
+
                void OnClick(object sender, EventArgs e)
                {
                        int i = 0;