PlaceholderColor does not work

1

I was trying an entry in xamarin.forms and I have the entry in white, so I wanted to change the color of the placeholder to black so I have it like this:

<Entry 
            x:Name="txtUser"
            Placeholder="Ingrese su usuario"
            BackgroundColor="White"
            PlaceholderColor="Black"
            HorizontalOptions="FillAndExpand"
            VerticalOptions="Center"
/>

But it does not work for me I get an error, investigate and I think it's because of the version, there is another way to change the text color of the placeholder without PlaceholderColor or TextColor (which does not work for me either)

    
asked by Josue Olivares 11.05.2016 в 17:29
source

1 answer

1

remember that Xamarin.Forms access the native components of the operating systems. if you wanted to modify those properties, you would have to make a Renderer of the Entry to be able to access that property natively.

  

Renderer Android

using Android.Views;
using Xamarin.Forms.Platform.Android;
using Xamarin.Forms;
using xxxxx.Droid.Renderers;

[assembly: ExportRenderer(typeof(Xamarin.Forms.Entry),typeof(ExtendedEntryRenderer))]
namespace xxxxx.Droid.Renderers
{

    public class ExtendedEntryRenderer : EntryRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
        {
            base.OnElementChanged(e);
            if (Control != null)
            {
                this.Control.SetBackgroundColor(Android.Graphics.Color.Transparent);
                this.Control.SetHintTextColor(Android.Graphics.Color.Gray);
                this.Control.SetMinHeight(60);
            }
        }
    }
}
  

Renderer iOS

using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using System.Drawing;
using UIKit;
using xxxxx.iOS.Renderers;

[assembly: ExportRenderer(typeof(Xamarin.Forms.Entry), typeof(ExtendedEntryRenderer))]
 namespace IGS.iOS.Renderers
{

public class ExtendedEntryRenderer : EntryRenderer
{

    protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
    {
        base.OnElementChanged(e);
        if (Control != null) 
           return

        Control.......

        }            
    }
}
    
answered by 12.10.2016 в 19:22