Creating a cross-platform login screen
Almost every application has an authentication screen. Here, we will examine the root application page of a Xamarin.Forms application by creating a login screen where the user can set his username, password and tap the login button to get access.
You can create a new solution or continue from the previous section.
How to do it...
In our core PCL project:
- Open the
FormsCookbook.cs
file. - Replace the code in the constructor with the following code snippet:
var userNameEntry = new Entry { Placeholder = "username" }; var passwordEntry = new Entry { Placeholder = "password", IsPassword = true }; var loginButton = new Button { Text = "Login" }; loginButton.Clicked += (sender, e) => { Debug.WriteLine(string.Format("Username: ...
Get Xamarin: Cross-Platform Mobile Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.