amatkivskiy/MaterialEditText-Xamarin

Use this component in a Xamarin.Forms

Opened this issue · 0 comments

Congratulations for the work. You know how I can use this component in a Xamarin.Forms project (Droid)?

I'm trying this:

[assembly: ExportRenderer (typeof (MyFloatLabeledEntry), typeof (Gelati.Droid.MyFloatLabeledEntryRenderer))]

namespace Gelati.Droid
{
public class MyFloatLabeledEntryRenderer : ViewRenderer<MyFloatLabeledEntry, MaterialEditText> // EntryRenderer // ViewRenderer<MyFloatLabeledEntry, FrameLayout>
{
public MyFloatLabeledEntryRenderer()
{
}

protected override void OnElementChanged (ElementChangedEventArgs<MyFloatLabeledEntry> e)    
{
  base.OnElementChanged (e);

  if (e.OldElement != null || this.Element == null)
    return;

  var entry = e.NewElement;
  if (entry != null) {
    Android.Content.Context context = Xamarin.Forms.Forms.Context;
    //_frame = new FloatLabeledEditText (_context);
    MaterialEditText frame = new MaterialEditText (context);
    frame.Text = entry.Text;
    frame.Hint = entry.Placeholder;
    //_frame.Font = UIFont.SystemFontOfSize (fieldFontSize),
    //ClearButtonMode = UITextFieldViewMode.WhileEditing,
    //FloatingLabelFont = UIFont.BoldSystemFontOfSize (fieldFloatingLabelFontSize),
    //FloatingLabelTextColor = entry.FloatingLabelColor.ToUIColor(),
    //FloatingLabelActiveTextColor = entry.FloatingLabelActiveColor.ToUIColor(),
    //BorderStyle = UITextBorderStyle.RoundedRect;

    SetNativeControl (frame);
  }
}

}
}

Thank you,
Homero