Last active
June 12, 2017 09:21
-
-
Save mmierzwa/252bfaae4c8db12a358a42473283c002 to your computer and use it in GitHub Desktop.
Placeholder text in Xamarin.Forms Editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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