Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
.NET MAUI Projects - Third Edition

You're reading from  .NET MAUI Projects - Third Edition

Product type Book
Published in Feb 2024
Publisher Packt
ISBN-13 9781837634910
Pages 630 pages
Edition 3rd Edition
Languages
Authors (3):
Michael Cummings Michael Cummings
Profile icon Michael Cummings
Daniel Hindrikes Daniel Hindrikes
Profile icon Daniel Hindrikes
Johan Karlsson Johan Karlsson
Profile icon Johan Karlsson
View More author details

Table of Contents (18) Chapters

Preface 1. Part 1: Introduction
2. Chapter 1: Introduction to .NET MAUI 3. Chapter 2: Building Our First .NET MAUI App 4. Chapter 3: Converting a Xamarin.Forms App into .NET MAUI 5. Part 2: Basic Projects
6. Chapter 4: Building a News App Using .NET MAUI Shell 7. Chapter 5: A Matchmaking App with a Rich UX Using Animations 8. Chapter 6: Building a Photo Gallery App Using CollectionView and CarouselView 9. Chapter 7: Building a Location Tracking App Using GPS and Maps 10. Chapter 8: Building a Weather App for Multiple Form Factors 11. Part 3: Advanced Projects
12. Chapter 9: Setting Up a Backend for a Game Using Azure Services 13. Chapter 10: Building a Real-Time Game 14. Chapter 11: Building a Calculator Using .NET MAUI Blazor 15. Chapter 12: Hot Dog or Not Hot Dog Using Machine Learning 16. Index 17. Other Books You May Enjoy

Preface

.NET MAUI Projects is a hands-on book in which you get to create nine applications from the ground up. You will gain the fundamental skills you need to set up your environment, and we will explain what .NET Mobile is before we transition into .NET MAUI to really take advantage of truly native cross-platform code.

After reading this book, you will have a real-life understanding of what it takes to create an app that you can build on and that stands the test of time.

We will cover, among other things, upgrading from Xamarin.Forms, animations, consuming REST interfaces, real-time communication using SignalR, and location tracking using a device’s GPS. There is also room for machine learning, a touch of .NET Blazor, and the must-have to-do list.

Happy coding!

Who this book is for

This book is for developers who know their way around C# and Visual Studio. You don’t have to be a professional programmer, but you should have basic knowledge of object-oriented programming using .NET and C#. The typical reader would be someone who wants to explore how you can use .NET Mobile, and specifically .NET MAUI, to create applications using .NET and C#.

No knowledge of .NET Mobile is required in advance, but it would be a great help if you’ve worked with traditional .NET Mobile and want to take the step toward .NET MAUI.

What this book covers

Chapter 1, Introduction to .NET MAUI, explains the basic concepts of .NET Mobile and .NET MAUI. It helps you understand the building blocks of how to create a true cross-platform app. It’s the only theoretical chapter of the book and will help you get started and set up your development environment.

Chapter 2, Building Our First .NET MAUI App, guides you through the concepts of Model-View-ViewModel (MVVM) and explains how to use the Inversion of Control pattern to simplify the creation of views and view models. We will create a to-do app that supports navigation, filtering, and the addition of to-do items to a list, and will also render a user interface that takes advantage of the powerful data-binding mechanisms in .NET MAUI.

Chapter 3, Converting a Xamarin.Forms App to .NET MAUI, walks through the steps to convert an existing Xamarin.Forms app running on Mono to a .NET MAUI app running on .NET 7. We will discuss two different methods for converting your Xamarin.Forms application to .NET MAUI. The first method will use a new .NET MAUI project and move our old Xamarin.Forms code into the new project, and the second method will use the .NET Upgrade Assistant tool to do some of the upgrades for us.

Chapter 4, Building a News App Using .NET MAUI Shell, explores the default navigation template in .NET MAUI, Shell, a standard way to define the structure of .NET MAUI apps. In this chapter, you will learn all you need to know to use Shell in a .NET MAUI app.

Chapter 5, A Matchmaking App with a Rich UX Using Animations, lets you dive deeper into how to define a richer user interface with animations and content placement. It also covers the concept of custom controls to encapsulate the user interface into self-contained components.

Chapter 6, Building a Photo Gallery App Using CollectionView and CarouselView, details the .NET MAUI CollectionView and CarouselView controls. In this chapter, we will use them to build a photo gallery app to learn how to master the controls.

Chapter 7, Building a Location Tracking App Using GPS and Maps, taps into the use of geolocation data from the device’s GPS and how to plot this data on a layer on a map. It also explains how to use background services to keep tracking the location over a long period of time to create a heat map of where you spend your time.

Chapter 8, Building a Weather App for Multiple Form Factors, is all about consuming a third-party REST interface and displaying the data in a user-friendly way. We will hook up to a weather service to get the forecast for the current location you are in and display the results in a list.

Chapter 9, Setting Up a Backend for a Game Using Azure Services, is the first of two parts in which we’ll set up a game app. This chapter explains how to use Azure services to create a backend that exposes functionality through SignalR to set up a real-time communication channel between apps.

Chapter 10, Building a Real-Time Game, follows on from the previous chapter and covers the frontend of the app – in this case, a .NET MAUI app that connects to the backend and relays messages between users. The chapter focuses on setting up SignalR on the client side and explains how to create a service model that abstracts this communication through messages and events.

Chapter 11, Building a Calculator Using .NET MAUI Blazor, explores a .NET Blazor app embedded within a .NET MAUI app. We will write part of the calculator app using Blazor and host that in .NET MAUI using BlazorWebView. We will also communicate between Blazor and .NET MAUI.

Chapter 12, Hot Dog or Not Hot Dog Using Machine Learning, covers the creation of an app that uses machine learning to identify whether an image contains a hot dog or not.

To get the most out of this book

We recommend that you read the first chapter to make sure that you are up to speed with the basic concepts of Xamarin in general. After that, you could pretty much pick any chapter you would like to learn more about. Each chapter is standalone but the chapters are ordered by complexity; the further you are into the book, the more complex the app will be.

The apps are adapted for real-world use but some parts are left out, such as proper error handling and analytics, since they are out of the scope of the book. However, you should get a good grasp of the building blocks of how to create an app.

Having said that, it does help if you have been a C# and .NET developer for a while, since many of the concepts are not really app-specific but are good practice in general, such as MVVM and Inversion of Control.

But, most of all, it’s a book you can use to kick-start your .NET MAUI development learning curve by focusing on what chapters interest you the most.

Software/Hardware covered in the book

OS requirements

Visual Studio Community Edition. A computer capable of running Windows 10 or later for UWP and Android. A Mac that is capable of running macOS Mojave 10.14 to use the iOS simulator

Windows 10 or later, macOS Sierra 10.12 or later

Xcode. A Mac that is capable of running macOS Sierra 10.14

macOS Mojave 10.14

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/MAUI-Projects-3rd-Edition. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “Since all .NET MAUI programs start with the MauiProgram.cs file, that seems like a good place to start.”

A block of code is set as follows:

.keypad {
    width: 300px;
    margin: auto;
    margin-top: -1.1em;
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

    builder.Services.AddMauiBlazorWebView();
#if DEBUG
    builder.Services.AddBlazorWebViewDeveloperTools();
    builder.Logging.AddDebug();
#endif

Any command-line input or output is written as follows:

$ mkdir ViewModels
$ cd ViewModels

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “Open Visual Studio 2022 and select Create a new project.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at customercare@packtpub.com and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share your thoughts

Once you’ve read .NET MAUI Projects, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781837634910

2. Submit your proof of purchase

3. That’s it! We’ll send your free PDF and other benefits to your email directly

lock icon The rest of the chapter is locked
Next Chapter arrow right
You have been reading a chapter from
.NET MAUI Projects - Third Edition
Published in: Feb 2024 Publisher: Packt ISBN-13: 9781837634910
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 $15.99/month. Cancel anytime}