top of page
Search

Xamarin Forms: Creating Simple Login

  • Writer: Cedric Gabrang
    Cedric Gabrang
  • Aug 30, 2018
  • 1 min read

Updated: Jun 9, 2019


Do you want to explore more?

Are you looking for a Xamarin kickstarter?


In this post, we will create simple login and registration.


Step 1: Right-click on your PCL project then Add > New Item > Content Page.

Name it as LoginPage.



Step 2: Open your LoginPage.xaml and add some label, entry and button controls.



Step 3: Add another ContentPage and name it RegistrationPage and create your registration page layout.



Step 4: Go to LoginPage.xaml once again and add clicked event to your Login and Register buttons.


Go to LoginPage.xaml.cs and under btnRegister_Clicked event, add this:



Step 5: Go to RegistrationPage.xaml once again and add clicked event to your Register button. Go to RegistrationPage.xaml.cs and under btnRegister_Clicked event, add this:

The Application subclass has a static Properties dictionary which can be used to store data. This can be accessed from anywhere in your Xamarin.Forms code using Application.Current.Properties. For more information, visit https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/application-class



Step 6: Go to LoginPage.xaml.cs and under btnLogin_Clicked event, add this:



Step 7: Build and deploy your app to your emulator or device.


And here’s what the app looks like when is running.



Here’s the VSTS GitHub repo of this demo.


That’s it! Try it yourself!


Until next time. Happy coding!


 
 
 

Recent Posts

See All

2 Comments


Body Art
Body Art
Nov 07, 2022

Would you be able to provide instructions for iOS and Android with a very similar login and registration page except with a SQLite database. I tried incorporating your instructions for your event list but I think i got lost because the project was titled Event app and C# uses event in its language. I've looked online and cant find exact instructions for login and registration with SQLite.

Like

Body Art
Body Art
Nov 05, 2022

you have to modify the App.xaml.cs file to say public App()

{

InitializeComponent();


MainPage = new NavigationPage(new LoginPage());

}


otherwise you keep getting cs0103 navigation does not exist globally took me half a day to work that out. I'm new at this so thanks for providing the code.

Like

Follow

  • facebook
  • twitter
  • instagram
  • linkedin

©2018 by Cedric Gabrang.

bottom of page