summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs
index dd7fb85c..492b553b 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs
@@ -2,6 +2,7 @@ using System;
using System.ComponentModel;
using System.Linq;
using Android.App;
+using Android.Content.Res;
using Android.Text;
using Android.Widget;
using Object = Java.Lang.Object;
@@ -12,6 +13,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
{
AlertDialog _dialog;
bool _disposed;
+ TextColorSwitcher _textColorSwitcher;
public PickerRenderer()
{
@@ -51,9 +53,11 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
textField.Tag = this;
textField.InputType = InputTypes.Null;
textField.SetOnClickListener(PickerListener.Instance);
+ _textColorSwitcher = new TextColorSwitcher(textField.TextColors);
SetNativeControl(textField);
}
UpdatePicker();
+ UpdateTextColor();
}
base.OnElementChanged(e);
@@ -67,6 +71,8 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
UpdatePicker();
if (e.PropertyName == Picker.SelectedIndexProperty.PropertyName)
UpdatePicker();
+ if (e.PropertyName == Picker.TextColorProperty.PropertyName)
+ UpdateTextColor();
}
internal override void OnFocusChangeRequested(object sender, VisualElement.FocusRequestArgs e)
@@ -123,6 +129,11 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
Control.Text = Element.Items[Element.SelectedIndex];
}
+ void UpdateTextColor()
+ {
+ _textColorSwitcher?.UpdateTextColor(Control, Element.TextColor);
+ }
+
class PickerListener : Object, IOnClickListener
{
#region Statics