Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Windows (Phone) Picker: Howto set Textcolor by more than 5 Values

$
0
0

Hi,
I have build a custom renderer to set the Textcolor (Foreground) for a Picker on Windows Phone.
`public class WindowsPickerRenderer : PickerRenderer
{
private static Brush _textColor;
private static Brush _borderColor;

    static WindowsPickerRenderer()
    {
        _textColor = new SolidColorBrush(Color.FromArgb((byte)255, (byte)(AppController.AppTextColor.R * 255), (byte)(AppController.AppTextColor.G * 255), (byte)(AppController.AppTextColor.B * 255)));
        _borderColor = new SolidColorBrush(Color.FromArgb((byte)255, (byte)(AppController.AppFormBorderColor.R * 255), (byte)(AppController.AppFormBorderColor.G * 255), (byte)(AppController.AppFormBorderColor.B * 255)));
    }

    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Picker> e)
    {
        base.OnElementChanged(e);

        Control.Foreground = _textColor;
        Control.BorderBrush = _borderColor;
        Control.BorderThickness = new Thickness(1);
    }
}`

It works fine, if the Picker has less than five values. But if there are more than no foreground color will be set.
How can I achive this too?


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>