Skip to content

Instantly share code, notes, and snippets.

@InnovativeTechies
Created July 8, 2020 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save InnovativeTechies/5b151c1e57fcd3ff79e64fa5e431232c to your computer and use it in GitHub Desktop.
Save InnovativeTechies/5b151c1e57fcd3ff79e64fa5e431232c to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Foundation;
using MaterialComponents;
using MaterialTextField;
using MaterialTextField.iOS;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(EntryView), typeof(MaterialEntryRenderer))]
namespace MaterialTextField.iOS
{
public class MaterialEntryRenderer:ViewRenderer<EntryView,TextField>
{
MaterialComponents.TextField textfield;
MaterialComponents.TextInputControllerOutlined textfieldController;
protected override void OnElementChanged(ElementChangedEventArgs<EntryView> e)
{
//base.OnElementChanged(e);
if (Control == null)
{
textfield = new MaterialComponents.TextField();
textfield.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
textfield.VerticalAlignment = UIControlContentVerticalAlignment.Center;
textfieldController = new MaterialComponents.TextInputControllerOutlined(textfield);
textfieldController.CharacterCountMax = 5;
textfieldController.CharacterCounter.CharacterCount(textfield);
textfieldController.TextInput.Placeholder = "Enter the value";
SetNativeControl(textfield);
}
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
}
private void Textfield_EditingDidBegin(object sender, EventArgs e)
{
var textfield = sender as TextField;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment