Skip to content

Instantly share code, notes, and snippets.

@mmierzwa
Last active June 12, 2017 09:21
Show Gist options
  • Save mmierzwa/252bfaae4c8db12a358a42473283c002 to your computer and use it in GitHub Desktop.
Save mmierzwa/252bfaae4c8db12a358a42473283c002 to your computer and use it in GitHub Desktop.
Placeholder text in Xamarin.Forms Editor
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(PlaceholderEditor), typeof(PlaceholderEditorRenderer))]
namespace EditorWithPlaceholder.Droid.Renderers
{
public class PlacehoderEditorRenderer : EditorRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
{
base.OnElementChanged(e);
if (Element == null)
return;
var element = (PlaceholderEditor) Element;
Control.Hint = element.Placeholder;
Control.SetHintTextColor(element.PlaceholderColor.ToAndroid());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment