.NET MAUI Cross-Platform Application Development: Leverage a first-class cross-platform UI framework to build native apps on multiple platforms

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Build apps for Android, iOS, macOS, and Windows using Microsoft's .NET Multi-platform App UI and Blazor

Key Features

  • Get familiar with Microsoft's UI toolkit to build amazing interfaces for iOS, Android, Windows, and macOS
  • Build a cross-platform password manager based on the famous Windows app, KeePass
  • Explore .NET MAUI development and Hybrid app development using Blazor

Book Description

An evolution of Xamarin.Forms, .NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and XAML. Using .NET MAUI, you can develop apps that'll run on Android, iOS, macOS, and Windows from a single shared code-base. This step-by-step guide provides a comprehensive introduction to those who are new to .NET MAUI that will have you up to speed with app development using .NET MAUI in no time.

The book begins by showing you how to develop a cross-platform application using .NET MAUI and then helps you build an app throughout the chapters. You'll gain all the knowledge needed to create a cross-platform application for Android, iOS, the mac OS, and Windows from a single shared code-base using .NET MAUI. As you advance, you'll get to grips with the entire application development lifecycle, from design and implementation through to deployment to the app store through the development of a password manager app using KeePassLib. The concluding chapters will teach you how to integrate the latest frontend technology into your app through .NET MAUI Blazor.

By the end of this book, you'll have learned how to develop your own cross-platform applications using .NET MAUI.

What you will learn

  • Discover the latest features of .NET 6 that can be used in mobile and desktop app development
  • Find out how to build cross-platform apps with .NET MAUI and Blazor
  • Implement device-specific features using .NET MAUI Essentials
  • Integrate third-party libraries and add your own device-specific features
  • Discover .NET class unit test using xUnit.net and Razor components unit test using bUnit
  • Deploy apps in different app stores on mobile as well as desktop

Who this book is for

This book is an entry-level .NET MAUI book for mobile developers interested in cross-platform application development with working experience of the .NET Core framework, as well as fresh or junior engineers who've just begun their career in mobile app development. Native application developers (desktop) or Xamarin developers who want to migrate to .NET MAUI will also benefit from this book. Basic knowledge of modern object-oriented programming language, such as C#, Java or Kotlin, is assumed.

Table of Contents

  1. Getting Started with .NET MAUI
  2. Building Our First .NET MAUI App
  3. User Interface Design with XAML
  4. Exploring MVVM and Data Binding
  5. Navigation using .NET MAUI Shell and NavigationPage
  6. Introducing Dependency Injection and Platform-Specific Services
  7. Introducing Blazor Hybrid App Development
  8. Understanding the Blazor Layout and Routing
  9. Implementing Blazor Components
  10. Advanced Topics in Creating Razor Components
  11. Developing Unit Tests
  12. Deploying and Publishing in App Stores

Author(s): Roger Ye
Publisher: Packt Publishing
Year: 2023

Language: English
Commentary: Original True PDF
Pages: 400

Cover
Title Page
Copyright and credits
Contributors
Table of Contents
Preface
Part 1: Exploring .NET MAUI
Chapter 1: Getting Started with .NET MAUI
An overview of cross-platform technologies
Native applications
Web applications
Backend services
Cross-platform technologies
A comparison of .NET, Java, and JavaScript
Exploring the .NET landscape
.NET Framework
Mono
.NET Core
.NET Standard and portable class libraries
Using Xamarin for mobile development
Xamarin.Forms
Xamarin.Essentials
Moving to .NET MAUI
.NET MAUI Blazor apps
Choosing XAML versus Razor in .NET MAUI
Development environment setup
Installing .NET MAUI on Windows
Installing .NET MAUI on macOS
What you will learn in this book
The app that we will build in this book
Summary
Further reading
Chapter 2: Building Our First .NET MAUI App
Technical requirements
Managing the source code in this book
Setting up a new .NET MAUI project
Creating a new project using Visual Studio
Creating a new project using the dotnet command
App startup and lifecycle
Lifecycle management
Configuring the resources
App icon
Splash screen
Setting custom font icons
Building and debugging
Windows
Android
iOS and macOS
Scaffolding a Model-View-ViewModel project
Migrating and reusing a Shell template from Xamarin.Forms
Visual Studio project template
Summary
Chapter 3: User Interface Design with XAML
Technical requirements
Creating a XAML page
XAML syntax
Element
Attribute
XML namespaces and XAML namespaces
XAML markup extensions
Master-detail UI design
Side-by-side
Stacked
Controls in .NET MAUI
Layouts in .NET MAUI
Navigation in the master-detail UI design
Supporting multiple languages – localization
Creating a .resx file
Localizing text
Summary
Further reading
Chapter 4: Exploring MVVM and Data Binding
Technical requirements
Understanding MVVM and MVC
MVVM in PassXYZ.Vault
Data binding
Binding mode
Changing notifications in viewmodels
Improving the data model and service
KPCLib
PassXYZLib
Updating the model
Updating the service
Binding to collections
Summary
Further reading
Chapter 5: Navigation using .NET MAUI Shell and NavigationPage
Technical requirements
Implementing navigation
INavigation interface and NavigationPage
Using the navigation stack
Manipulating the navigation stack
Using Shell
Flyout
Tabs
Shell navigation
Improving our model
Understanding the data model and its services
Improving the login process
The Command interface
Summary
Chapter 6: Introducing Dependency Injection and Platform-Specific Services
Technical requirements
A quick review of design principles
Exploring types of design principles
Using design principles
Using DI
Dependency Service
Using built-in MS.DI DI service
Connecting to the database
Initializing the database
Performing CRUD operations
Summary
Further reading
Part 2: Implementing .NET MAUI Blazor
Chapter 7: Introducing Blazor Hybrid App Development
Technical requirements
What is Blazor?
Learning about Blazor Server
Understanding Blazor Wasm
Exploring Blazor Hybrid
Creating a new .NET MAUI Blazor project
Generating a .NET MAUI Blazor project with the dotnet command line
Creating a .NET MAUI Blazor project using Visual Studio on Windows
Running the new project
The startup code of the .NET MAUI Blazor app
Migrating to a .NET MAUI Blazor app
Understanding Razor syntax
Code blocks in Razor
Implicit Razor expressions
Explicit Razor expressions
Expression encoding
Directives
Directive attributes
Creating a Razor component
Redesigning the login page using a Razor component
The Model-View-ViewModel (MVVM) pattern in Blazor
Dependency injection in Blazor
CSS isolation
Summary
Chapter 8: Understanding the Blazor Layout and Routing
Technical requirements
Understanding client-side routing
Setup of BlazorWebView
Setup of Router
Defining routes
Using Blazor layout components
Applying a layout to a component
Nesting layouts
Implementing navigation elements
Implementing a list view
Adding a new item and navigating back
Summary
Chapter 9: Implementing Blazor Components
Technical requirements
Understanding Razor components
Inheritance
Creating a Razor class library
Using static assets in the Razor class library
Creating reusable Razor components
Creating a base modal dialog component
Data binding
Component parameters
Nested components
Two-way data binding
Communicating with cascading values and parameters
Understanding the component lifecycle
SetParametersAsync
OnInitialized and OnInitializedAsync
OnParametersSet and OnParametersSetAsync
ShouldRender
OnAfterRender and OnAfterRenderAsync
Implementing CRUD operations
CRUD operations of items
CRUD operations of fields
Summary
Chapter 10: Advanced Topics in Creating Razor Components
Technical requirements
Creating more Razor components
Creating the Navbar component
Creating a Dropdown component for the context menu
Using templated components
Creating a ListView component
Using the ListView component
Built-in components and validation
Using built-in components
Using the EditForm component
Creating an EditFormDialog component
Summary
Further reading
Part 3: Testing and Deployment
Chapter 11: Developing Unit Tests
Technical requirements
Unit testing in .NET
Setting up the unit test project
Creating test cases to test the IDataStore interface
Sharing context between tests
Razor component testing using bUnit
Changing project configuration for bUnit
Creating a bUnit test case
Creating test cases in Razor files
Using the RenderFragment delegate
Testing Razor pages
Summary
Further reading
Chapter 12: Deploying and Publishing in App Stores
Technical requirements
Preparing application packages for publishing
What to prepare for publishing
Publishing to Microsoft Store
Publishing to the Google Play Store
Publishing to Apple’s App Store
GitHub Actions
Understanding GitHub Actions
Summary
Index
Other Books You May Enjoy