Skip to content

SmagPie/XamarinFormsPinView

 
 

Repository files navigation

PIN keyboard for Xamarin.Forms.

 

Usage

  1. Add the following NuGet package: https://www.nuget.org/packages/FormsPinView/ NuGet

    OR

    add FormsPinView.PCL, FormsPinView.iOS, and FormsPinView.Droid to your solution.

  2. Initialize iOS and Android renderers:

     // iOS:
     public override bool FinishedLaunching(UIApplication app, NSDictionary options)
     {
         ...
         global::Xamarin.Forms.Forms.Init();
         PinItemViewRenderer.Init();
     }
     
     // Android:
     protected override void OnCreate(Bundle bundle)
     {
         ...
         global::Xamarin.Forms.Forms.Init(this, bundle);
         PinItemViewRenderer.Init();
     }
    
  3. Add PinView to your page:

     ...
     xmlns:local="clr-namespace:FormsPinView.PCL;assembly=FormsPinView.PCL"
     ...
         <local:PinView
             Title="🔐 Enter your PIN"
             HorizontalOptions="CenterAndExpand"
             VerticalOptions="CenterAndExpand"
             BindingContext="{Binding PinViewModel}" />
    
  4. PinView is MVVM-ready, so you may inherit from PinViewModel:

     public class YourPageViewModel
     {
         ...
         
         public PinViewModel PinViewModel { get; private set; } = new PinViewModel
         {
             TargetPinLength = 4,
             ValidatorFunc = (arg) => 
             {
                 //TODO Check entered pin
                 return true;
             }
         };
         
         ...
     }
    

License

BSD 2-Clause.

About

PIN keyboard for Xamarin.Forms.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 86.2%
  • F# 13.8%