<p><span>A practical guide to mastering C# and .NET MAUI to build native cross-platform apps with a single codebase</span></p><p><span>Purchase of the print or Kindle book includes a free PDF eBook</span></p><h4><span>Key Features</span></h4><ul><li><span><span>Extend your skills to build cross-plat
.NET MAUI for C# Developers: Build cross-platform mobile and desktop applications
β Scribed by Jesse Liberty, Rodrigo Juarez
- Publisher
- Packt Publishing
- Tongue
- English
- Leaves
- 296
- Category
- Library
No coin nor oath required. For personal study only.
β¦ Synopsis
A practical guide to mastering C# and .NET MAUI to build native cross-platform apps with a single codebase
Purchase of the print or Kindle book includes a free PDF eBook
Key Features
- Extend your skills to build cross-platform native apps for iOS, Android, Windows, and Mac
- Learn by working on a real-world project
- Go beyond MAUI and integrate with the .NET ecosystem
Book Description
While UI plays a pivotal role in retaining users in a highly competitive landscape, maintaining the same UI can be tricky if you use different languages for different platforms, leading to mismatches and un-synced pages. In this book, you'll see how .NET MAUI allows you to create a real-world application that will run natively on different platforms. By building on your C# experience, you'll further learn to create beautiful and engaging UI using XAML, architect a solid app, and discover best practices for this Microsoft platform.
The book starts with the fundamentals and quickly moves on to intermediate and advanced topics on laying out your pages, navigating between them, and adding controls to gather and display data. You'll explore the key architectural pattern of Model-View-ViewModel: and ways to leverage it. You'll also use xUnit and NSubstitute to create robust and reliable code.
By the end of this book, you'll be well-equipped to leverage .NET MAUI and create an API for your app to interact with a web frontend to the backend data using C#.
What you will learn
- Explore the fundamentals of creating .NET MAUI apps with Visual Studio
- Understand XAML as the key tool for building your user interface
- Obtain and display data using layout and controls
- Discover the MVVM pattern to create robust apps
- Acquire the skills for storing and retrieving persistent data
- Use unit testing to ensure your app is solid and reliable
Who this book is for
Learning .NET MAUI is targeted squarely at C# programmers, whether or not they have experience with cross-platform or mobile applications, who wish to learn Microsoft's premier platform for building iOS, Android, Windows and Mac apps using a single C#-based solution.
Table of Contents
- Assembling your tools and creating your first app
- What we will build: Forget Me
- XAML and Fluent C#
- Controls
- Pages and Layout
- Databinding and the MVVM pattern
- Navigation and routes
- Storing and retrieving data
- Unit Testing with Mocks
- Custom Controls
- Creating a back end service and API
β¦ Table of Contents
Cover
Copyright
Foreword
Contributors
Table of Contents
Preface
Part 1 β Getting Started
Chapter 1: Assembling Your Tools and Creating Your First App
Technical requirements
Getting and installing Visual Studio
Installing Visual Studio
Git
Opening Visual Studio
Quick tour of the app
Summary
Quiz
You try it
Chapter 2: What We Will Build: Forget Me Not
Technical requirements
What is Forget Me Not?
Buddies
Inviting Buddies
Other pages
What youβll learn
Summary
Chapter 3: XAML and Fluent C#
Technical requirements
Understanding the structure of XAML
The code-behind file
Exploring the layout options
VerticalStackLayout
Image
Label
Code-behind and event handlers
If you can do it in XAML, you can do it in C#
C# versus Fluent C#
Summary
Quiz
Try it out
Chapter 4: MVVM and Controls
Technical requirements
Setting up for MVVM
Creating folders
The MVVM Community Toolkit
Exploring views
Forget Me Not labels
Data binding
Creating a public property
Setting up BindingContext
Assigning values to the View Model class properties
Implementing Binding
ViewModel versus code-behind
Views
Images
Button properties
ImageButton
TapGestureRecognizer
Entering text
Behaviors
Popups and dialogs
Presenting the user with a choice
ActionSheet
Displaying a prompt
Toast
Snackbar
BoxView
Frame
Brushes
The Solid brush
LinearGradientBrush
RadialGradientBrush
Summary
Quiz
You try it
Chapter 5: Advanced Controls
Technical requirements
Keeping the user informed of activity
ActivityIndicator
ProgressBar
Moving event handling to ViewModel
Breaking it down
Sending and receiving messages
Getting started with WeakReferenceMessenger
Creating the page in C#
Displaying collections
Overriding OnAppearing
Understanding how the service works
Displaying the collection of Preference objects
The code-behind
Styles
Explicit versus implicit styles
Style inheritance or BasedOn
Summary
Quiz
You try it
Chapter 6: Layout
Technical requirements
Stack layouts
Grid
Sizing rows and columns
Named rows and columns
ScrollView
FlexLayout
Summary
Quiz
You try it
Part 2 β Intermediate Topics
Chapter 7: Understanding Navigation
Technical requirements
Exploring the TabBar
Creating the About and Buddies pages
Assembling the About page
Shell navigation
Routing
Passing values from page to page
Passing values with the url (?) syntax
Passing values with a dictionary
Summary
Quiz
You try it
Chapter 8: Storing and Retrieving Data
Technical requirements
Storing user preferences
UserPreferencesViewModel
Navigating to UserPreferences
Retrieving the preferences
Storing to a database on your device
Installing SQLite
Getting started with SQLite
The Database class
CRUD
Local or remote?
Summary
Quiz
You try it
Chapter 9: Unit Testing
Technical requirements
Why create unit tests?
Vote early and vote often
Creating unit tests
Setting the project reference
Creating the first unit test
Tweaking the project file
Running the test
ForgetMeNotDemo unit tests
Implementing the triple-A pattern
Whatβs wrong with this test?
Mocks
Dependency injection
Creating an interface
Modifying the class constructor
The .NET MAUI IoC container
Registering your interfaces, services, and ViewModels
Using the NSubstitute package
Adding NSubstitute to your test fixture
Testing corner cases
Summary
Quiz
You try it
Part 3 β Advanced Topics
Chapter 10: Consuming REST Services
Technical requirements
Using REST Services
The Forget Me Not API architecture
Creating the projects
Fleshing out the models
Examining the API domain objects
Reviewing DTOs
Other DTO files
Understanding ForgetMeNot.APIClient
Authentication
Profile
The Buddy region
Using the API
Creating the account
Modifying the Login page
Updating LoginPage
The AccountService class
Updating LoginViewModel
Using AccountService to log in
Setting up the Create Account page
Setting up CreateAccountViewModel
Handling the SignUp command
What to do if it wonβt build
Summary
Quiz
You try it
Chapter 11: Exploring Advanced Topics
Technical requirements
Selecting data templates at runtime
Declaring ItemTemplates as resources
The DataTemplate selection
The DataTemplateSelector class
Adding the template selector to the pageβs resources
Adding DataTemplateSelector to CollectionView
Managing Visual State
Defining the common visual states
A button VisualState example
Utilizing Community Toolkit behaviors
Taking action with triggers
Summary
Quiz
You try it
Assessments
Chapter 1, Assembling Your Tools and Creating Your First App
Chapter 3, XAML and Fluent C#
Chapter 4, MVVM and Controls
Chapter 5, Advanced Controls
Chapter 6, Layout
Chapter 7, Understanding Navigation
Chapter 8, Storing and Retrieving Data
Chapter 9, Unit Testing
Chapter 10, Consuming REST Services
Chapter 11, Exploring Advanced Topics
Index
Other Books You May Enjoy
π SIMILAR VOLUMES
.NET MAUI MVVM Design Pattern: Build Blazing-Fast, Cross-Platform Apps That Captivate Users Do you dream of crafting stunning, responsive applications that work flawlessly on any device? Then unleash the power of .NET MAUI and the MVVM design pattern! This book is your comprehensive guide, taking y
This revised and expanded guide teaches you how to use .NET MAUI for cross-platform development. You will learn how to handle data with the MVVM model, use Blazor UI tools, and migrate from Xamarin.Forms for modern hybrid app development.
True PDF
<span><p>Get a complete overview of offline installable applications. Businesses need reliable applications that enable users to access data and their applications in spite of a bad network connection.Β Β </p> <p>Traditional websites work only when connected to the network. With a large number of user
<span><p>Get a complete overview of offline installable applications. Businesses need reliable applications that enable users to access data and their applications in spite of a bad network connection.Β Β </p> <p>Traditional websites work only when connected to the network. With a large number of user