3 Making .NET MAUI apps interactive

 

This chapter covers:

  • Databinding
  • An introduction to the MVVM pattern
  • Using common operating system and device features
  • Data persistence

In the last chapter we built and ran our first .NET MAUI app and made some small changes, but our app didn’t really do anything. You may have spotted the ‘Click me’ button, which when clicked on increases a number displayed on screen. In this chapter we’ll look at how this works and see that we can get and set values on UI elements from code.

Increasing a counter isn’t the most exciting thing in the world, and it’s something you can easily do with a web app. So, in this chapter we’ll start to explore device capabilities that make building mobile and desktop applications with .NET MAUI fun.

In this chapter we’ll see how databinding is used to bind values and commands from our UI to our code. We’ll start by looking at how the class corresponding to our view can easily manipulate our view, and then how this becomes more complex when introducing a ViewModel, and then we’ll see how we can use databinding to overcome that.

We’ll go through a couple of examples that will demonstrate this, while also learning how we can persist data locally on our device, and how we can access common device and operating system features through the .NET MAUI Essentials library.

3.1 The .NET MAUI Essentials library – using OS and device features

 

3.1.1 Android Metadata

 
 
 

3.1.2 iOS Metadata

 
 
 
 

3.1.3 Windows Metadata

 
 

3.2 The FindMe UI

 
 

3.3 Persisting data on your user’s device

 
 
 

3.4 Databinding – connecting UI to code

 

3.4.1 Introduction to Data Binding

 
 

3.4.2 View to View Bindings

 
 
 

3.4.3 Collections and Bindings in code

 
 
 

3.5 Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest