Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Mastering Xamarin UI Development
Mastering Xamarin UI Development

Mastering Xamarin UI Development: Build robust and a maintainable cross-platform mobile UI with Xamarin and C# 7 , Second Edition

Arrow left icon
Profile Icon Steven F. Daniel
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
Paperback Aug 2018 584 pages 2nd Edition
eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Steven F. Daniel
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
Paperback Aug 2018 584 pages 2nd Edition
eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Mastering Xamarin UI Development

Building a PhotoLibrary App Using Android

In the previous chapter, we learned how to download and install the Visual Studio for Mac IDE as well as the Xamarin Platform SDKs and components for both the iOS and Android platforms. We also covered some of the features contained in the Visual Studio for Mac IDE and then dived into learning about the Xamarin Mobile platform, as well as the benefits of developing Native versus Xamarin.Forms apps.

We learned how to create a cross-platform Xamarin project for both the iOS and Android platforms, and constructed the user interface by using the XAML syntax and writing the C# code that will be used to communicate with the XAML to populate a ListView control with planet names.

Finally, we learned how to set breakpoints and create conditional breakpoints, as well as using the built-in debugger in the Visual Studio for Mac IDE, which allows you...

Creating a native Android app using Visual Studio for Mac

In this section, we will take a look at how to create a native Android solution for the first time. We will begin by developing the basic structure for our application, as well as adding the Xamarin Media Plugin NuGet package and designing the user interface using XML for our PhotoLibrary application.

We will also learn how to update the Strings XML file to include values for our UI control elements that are contained in our XML file. Finally, we will create the styles XML file for our Photo Library app that will be used to style our UI control elements.

Before we can proceed, we need to create our PhotoLibrary project. It is very simple to create this using Visual Studio for Mac. Simply follow these steps:

  1. Firstly, launch the Visual Studio for Mac application.
  2. Next, choose the New Solution… option, or alternatively...

Creating and implementing the PhotoLibrary Activity class

In this section, we will start by creating the PhotoLibrary Activity class that will be used to interact with our PhotoLibraryUI user interface, and handle when each of the buttons has been pressed.

Let's start by creating the PhotoLibraryActivity class for our PhotoLibrary app in the following steps:

  1. Ensure that the PhotoLibrary solution is currently open in the Visual Studio for Mac IDE.
  2. Next, right-click on the PhotoLibrary project and choose Add|New File... from the pop-up menu, as shown in the following screenshot:
Creating a new Android Activity Class
  1. Then, choose the Activity option under the Android section and enter PhotoLibraryActivity for the name of the new Activity file to be created, as shown in the following screenshot:
Creating the PhotoLibraryActivity Class
  1. Next, click on the New button to allow...

Implementing Material Design in the PhotoLibrary app

In the previous sections, we looked at how to create the user interface for our app, update the Strings.xml file, and create the styles.xml file. Lastly, we looked at creating PhotoLibraryActivity and making some changes to the MainActivity class.

In this section, we will learn how to go about creating and implementing custom Material Design Themes, and how to implement Material Design in the PhotoLibrary application.

Creating custom themes for the PhotoLibrary application

Creating custom themes for your apps is extremely easy. Android themes are similar to using CSS style sheets in your web applications for user interface design. Themes allow you to separate styles from...

Setting up camera and photo album permissions

Before we can start accessing the camera and photo album, we will need to assign certain permissions for our PhotoLibrary Android app. To do this, we need to make some changes to our Android Manifest file to give access to our camera and photo album.

Let's start by updating the AndroidManifest.xml file for our PhotoLibrary app by performing the following steps:

  1. Expand the Properties folder in the PhotoLibrary solution and double-click on the AndroidManifest.xml file. Ensure that you have selected the Source button, which is located at the bottom of the screen, as shown in the following screenshot:
Setting up Camera and Photo Album Permissions
  1. Then, ensure that the AndroidManifest.xml file is displayed in the code editor and enter the following code snippet:
     <?xml version="1.0" encoding="utf-8"...

Launching the Photo Library app using the Android emulator

In this section, we will take a look at how to compile and run our PhotoLibrary. You have the option of choosing to run your application using an actual device or choosing from a list of emulators available for an Android device.

Let's begin by performing the following steps:

  1. Ensure that you have chosen the PhotoLibrary project from the drop-down menu.
  2. Next, choose your preferred device from the list of available Android emulators.
  3. Then, select the Run|Start Debugging menu option, as shown in the following screenshot:
Launching the PhotoLibrary App within the Android Emulator
  1. Alternatively, you can also build and run the PhotoLibrary application by pressing Command + Enter.

When the compilation is complete, the Android emulator will appear automatically and the PhotoLibrary application will be displayed, as shown...

Summary

In this chapter, we focused primarily on how to develop a native Android app using Visual Studio for Mac, Xamarin.Android, and C#. You learned how to use and work with the Visual Designer in the Visual Studio for Mac IDE to construct the user interface for your PhotoLibrary app using XML and implement Material Design in your apps, as well as create your own custom themes and then apply theming to your app.

Finally, you learned how to provide the necessary permissions to AndroidManifest.xml so that we can interact with the device camera and photo album, before launching the app in the Android emulator. In the next chapter, you will learn how to build a tile sliding game using Xamarin.iOS and C#.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Build effective native and cross-platform user interfaces using the Xamarin frameworks for iOS and Android, as well as Xamarin.Forms
  • Maximize the testability, flexibility, and overall quality of your Xamarin mobile apps
  • Step-by-Steps guide that is packed with real-world scenarios and solutions, to build professional grade mobile apps and games for the iOS and Android platforms, using C# 7

Description

This book will provide you with the knowledge and practical skills that are required to develop real-world Xamarin and Xamarin.Forms applications. You’ll learn how to create native Android app that will interact with the device camera and photo gallery, and then create a native iOS sliding tiles game. You will learn how to implement complex UI layouts and create customizable control elements based on the platform, using XAML and C# 7 code to interact with control elements within your XAML ContentPages. You’ll learn how to add location-based features by to your apps by creating a LocationService class and using the Xam.Plugin.Geolocator cross-platform library, that will be used to obtain the current device location. Next, you’ll learn how to work with and implement animations and visual effects within your UI using the PlatformEffects API, using C# code. At the end of this book, you’ll learn how to integrate Microsoft Azure App Services and use the Twitter APIs within your app. You will work with the Razor Templating Engine to build a book library HTML5 solution that will use a SQLite.net library to store, update, retrieve, and delete information within a local SQLite database. Finally, you will learn how to write unit tests using the NUnit and UITest frameworks.

Who is this book for?

This book is intended for readers who have experience using at least the C# 6.0 programming language and interested in learning how to create stunning native, and cross-platform user interfaces for the iOS and Android platforms using the Xamarin and Xamarin.Forms frameworks using C# 7.

What you will learn

  • Downloading and Installing the Visual Studio for Mac IDE
  • Overview and Understanding of the Xamarin Mobile Platform
  • Understand the MVVM architectural pattern and how to implement this with your apps
  • Build a NavigationService class to enable navigation between your ViewModels
  • Implement Data-Binding to control elements within your XAML pages and ViewModels
  • Create and Implement Xamarin.Forms Animations within your applications
  • Work with the Microsoft Azure App Services Platform and the Facebook SDK

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 31, 2018
Length: 584 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788995511
Vendor :
Microsoft
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Aug 31, 2018
Length: 584 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788995511
Vendor :
Microsoft
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 94.97
Xamarin.Forms Projects
€32.99
Mastering Xamarin.Forms
€24.99
Mastering Xamarin UI Development
€36.99
Total 94.97 Stars icon

Table of Contents

14 Chapters
Setting Up Visual Studio for Mac Chevron down icon Chevron up icon
Building a PhotoLibrary App Using Android Chevron down icon Chevron up icon
Building a SlidingTiles Game Using Xamarin.iOS Chevron down icon Chevron up icon
Creating the TrackMyWalks Native App Chevron down icon Chevron up icon
MVVM and Data Binding Chevron down icon Chevron up icon
Navigating Within the Mvvm Model Chevron down icon Chevron up icon
Adding Location-based Features Within Your App Chevron down icon Chevron up icon
Customizing the User Interface Chevron down icon Chevron up icon
Working with Animations in Xamarin.Forms Chevron down icon Chevron up icon
Working with the Razor Templating Engine Chevron down icon Chevron up icon
Incorporating Microsoft Azure App Services Chevron down icon Chevron up icon
Making Our App Social Using the Twitter API Chevron down icon Chevron up icon
Unit Testing Your Xamarin.Forms Apps Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Amazon Customer Jan 07, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
While this book is ultimately about about UI development with Xamarin, it fortunately does not assume too much about you besides an understanding of C# and OOP programming techniques. This is good as this is essentially a crash course on getting you up to speed with UI crossplatform mobile apps with Xamarin. Explanations was to the point and I was able to understand how the photoapp example in the book is built and run pretty quickly.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.