Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Xamarin UI Development

You're reading from   Mastering Xamarin UI Development Build robust and a maintainable cross-platform mobile UI with Xamarin and C# 7

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781788995511
Length 584 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Steven F. Daniel Steven F. Daniel
Author Profile Icon Steven F. Daniel
Steven F. Daniel
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Setting Up Visual Studio for Mac FREE CHAPTER 2. Building a PhotoLibrary App Using Android 3. Building a SlidingTiles Game Using Xamarin.iOS 4. Creating the TrackMyWalks Native App 5. MVVM and Data Binding 6. Navigating Within the Mvvm Model 7. Adding Location-based Features Within Your App 8. Customizing the User Interface 9. Working with Animations in Xamarin.Forms 10. Working with the Razor Templating Engine 11. Incorporating Microsoft Azure App Services 12. Making Our App Social Using the Twitter API 13. Unit Testing Your Xamarin.Forms Apps 14. Other Books You May Enjoy

What this book covers

Chapter 1, Setting Up Visual Studio for Mac, focuses on how to download and install Visual Studio Community 2017 for Mac, as well as the Xamarin components for both the iOS and Android platforms. You'll explore some of the features contained within the Visual Studio for Mac IDE, and then gain an understanding of the Xamarin mobile platform. You'll learn how to create your very first Xamarin.Forms cross-platform application and create the user interface using XAML and the underlying C# code. We we also cover how to set and define conditional breakpoints within your code, as well as how to use the built-in debugging tools to debug your application.

Chapter 2, Building a Photo Library App Using Android, focuses on how to develop native Android app using Visual Studio for Mac, Xamarin.Android and C#. You'll learn how to use and work with the Visual Designer to construct the user interface for our PhotoLibrary app using XML and implement Material Design within your apps, as well as creating your own custom themes and then apply theming to your app. You'll learn how to provide the necessary permissions to the AndroidManifest.xml so that we can interact with the device camera and photo album, before launching the app within the Android emulator.

Chapter 3, Building a SlidingTiles Game Using Xamarin.iOS, focuses on how to develop a native iOS app using Visual Studio for Mac, Xamarin.iOS, and C#. You'll learn how to use and work with Storyboards to construct the user interface for our SlidingTiles game by dragging a number of Labels, Views, and Buttons that will make up our game. You'll create a GameTile interface and class that will be used to create each of the tiles for our game, and then implement the remaining logic within the ViewController class to build the game board and create each of our game tiles using the images from an array.

You'll also create an instance method that will randomly shuffle each of our game tiles within our game board using the Random class, and work with the UITouch class to handle touch events to determine when a game tile has been tapped within the game boards UIView, and work with CoreAnimation so that you can apply simple animations to your UIViews by using View Transitions within an animation block, before deploying and launching the app within the iOS Simulator.

Chapter 4, Creating the TrackMyWalks Native App, will focus on how to develop a cross-platform app using Xamarin.Forms and C#, by creating each of the Content Pages that will form the user interface for our app using XAML, as well as creating a C# class that will act as the data-model for our application.

Chapter 5, MVVM and Data Binding, teaches you the concepts behind the MVVM architectural pattern, as well as how to implement the MVVM architectural pattern within the TrackMyWalks application. You'll learn how to create a BaseViewModel base class that every ViewModel will inherit from, as well as creating the associated C# class files for each of our ViewModels that will data-bind to each of the properties defined within our XAML Pages.

The associated properties that we define within the ViewModel for the ContentPage will be used to represent the information that will be displayed within the user interface for our application. You'll also learn how to add ContextActions to your (XAML) content pages, and how to implement the code action events within your code, so that you can respond to those actions.

Chapter 6, Navigating Within the MVVM Model, shows you how you can leverage what you already know about the MVVM architectural design pattern to learn how to navigate between each of the ViewModels within our TrackMyWalks application. You'll learn how to create a NavigationService class and update our BaseViewModel base class that will include a reference to our NavigationService class that each of our ViewModels will utilize. You will then proceed to update each of the ViewModels as well as each of the XAML pages to allow navigation between these pages to happen.

Chapter 7, Adding Location-Based Features within Your App, shows how you can incorporate platform-specific features within your application, which is dependent on the mobile platform that is being run. You will then learn how to incorporate the Xam.Plugin.Geolocator NuGet package that you will use in order to create a LocationService class so that you can obtain current GPS coordinates and handle location updates in the background on the device.

You'll update both the WalkEntryPageViewModel and WalkDistancePageViewModel to allow location-based features to happen and create a CustomMapOverlay class that will be used to display a native Map control, based on the platform. You'll learn how to perform location updates in the background so that you can update the native map control automatically, whenever new location coordinates are obtained.

Chapter 8, Customizing the User Interface, shows how you can use and customize DataTemplates to lay out your Views beautifully and neatly within your user interfaces by modifying your ContentPages. You'll learn how to create and implement various styles within each of your XAML pages, prior to getting accustomed to working with the PlatformEffects API to customize the appearance, as well as applying styling to native control elements for each platform. You'll learn how to set up your margins and apply padding, as well as how to create and implement ValueConverters and ImageConverters.

Chapter 9, Working with Animations in Xamarin.Forms, shows you how to work with the Animation class that comes part of the Xamarin.Forms platform, so that you can apply really cool animations and transition effects to your user interfaces and control elements, by implementing Simple Animations, Easing Functions, and Entrance Animations using C# code.

Chapter 10, Working with the Razor Templating Engine, focuses on how you can use the Razor Templating Engine to create a Book library mobile application using the power of Razor templates. You'll learn how to create a BookItem data-model within your application, as well as how to incorporate the SQLite-net NuGet package within your application, that you will use to create a BookDatabase class, that will include various methods to communicate with a SQLite database to Create, Update, Retrieve, and Delete book items. Finally, you will learn how to create the necessary Razor Template Pages, that will use our BookItem data model to display book information.

Chapter 11, Incorporating Microsoft Azure App Services, focuses on showing you how you can use the Microsoft Azure App Services Platform to create your cloud-based databases. You will learn how to set up and configure a Microsoft Azure App Service, as well as configuring the SQL Server database and the WalkEntries table for our app. You'll incorporate the Newtonsoft.Json NuGet package, as well as modify the WalkDataModel data model. You will then create a RestWebservice class, which will include a number of class instance methods that will be used to communicate with our TrackMyWalks SQL Server database, so you can perform CRUD operations to Create, Update, Retrieve, and Delete walk entries.

Chapter 12, Making Our App Social – Using the Twitter API, focuses on showing you how to create and register our TrackMyWalks app within the Twitter Portal, by applying for a Twitter developer account. You'll incorporate the Xamarin.Auth NuGet package within our solution and create a TwitterService class that we can use to communicate with the Twitter APIs using RESTful web service calls. You will then create a TwitterSignInPage and the associated TwitterSignInPageViewModel and TwitterSignInPageRenderer class, so users can sign into your app using their Twitter credentials.

Finally, you'll update the WalksMainPage code-behind to call our TwitterSignInPage to check to see if the user has signed in, as well as making changes to our WalkDistancePage XAML and code-behind so that we can utilize our TwitterService class to display profile information, as well as posting information about the trail to the user's Twitter feed.

Chapter 13, Unit Testing Your Xamarin.Forms Apps, focuses on showing you how to create and run each of your unit tests using the xUnit and Xamarin.UITest frameworks. You will also learn how to write unit tests for our ViewModels that will essentially test the business logic to validate that everything is working correctly, after which, we will move on to learning how to use the UITest framework to perform testing on the TrackMyWalks user interfaces, using automated testing.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime