Xamarin Forms: FloatingTextEntry Control

This is a very beautiful extended Entry control for Xamarin.Forms that allows devs display TextInputLayout(Material Design)-like


this is the control usage and setup:

Setup
- iOS
-- Add the following line in your AppDelegate:
FloatingTextEntryRenderer.Init ();
- Android
-- 1 Add material design to you Xamarin.Forms app.
Look at this tutorial https://blog.xamarin.com/material-design-for-your-xamarin-forms-android-apps/
-- 2 Setup the color.
In your theme xml add the following nodes:
//Accent Color
<item name="colorAccent">@color/accent</item>
//Inactive stroke color
<item name="colorControlNormal">@color/primaryDark</item>
//Inactive hint text color
<item name="android:textColorHint">@color/primaryDark</item>
-- 3 Setup your app.
Add the fallowing code in your Main Activity "OnStart" method:
FloatingTextEntryRenderer.Init ();
view raw 1 Setup.txt hosted with ❤ by GitHub
var passEntry = new FloatingTextEntry ();
passEntry.Placeholder = "Password";
passEntry.AccentColor = Color.FromHex("#FFC107");
passEntry.InactiveAccentColor = Color.FromHex ("#1976D2");
passEntry.TextColor = Color.Purple;
passEntry.Completed += passEntry_Completed;
passEntry.IsPassword = true;
//Custom Error Message/Color/Validator
passEntry.ErrorColor = Color.Red;
passEntry.ErrorText = "Bad Email";
//Put default emailvalidator
passEntry.Validator = FloatingTextEntry.EmailValidator;
//or create your own validator
passEntry.Validator = (string input) => {
return !string.IsNullOrWhiteSpace (input);
};
And the result is the next:



Download the code source from here:
https://github.com/AlejandroRuiz/FloatingTextEntry

Comentarios

  1. Informative blog! I am truly awed by this blog post! Very clear explanation about the Xamarin Development. I agree with all points.
    Hire affordable Xamarin Developer

    ResponderEliminar

Publicar un comentario

Entradas populares