3 Making .NET MAUI apps interactive

 

This chapter covers

  • Defining app permissions in metadata files
  • Using location, messaging, and other common operating system and device features
  • Saving and encrypting data to users’ devices
  • Connecting UI properties with data binding
  • Using collections and templates to display lists of data

In chapter 2, 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, increases a number displayed onscreen. In this chapter, we 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 start to explore device capabilities that make it fun to build mobile and desktop applications with .NET MAUI.

In this chapter, we see how data binding is used to bind values and commands from our UI to our code, and we see how the class corresponding to our view can easily manipulate our view. We go through a couple of examples that demonstrate this while also learning how to persist data locally on our device and access common device and OS features through the .NET MAUI APIs.

3.1 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 Data binding: Connecting the UI to the code

3.4.1 View-to-view bindings

3.4.2 Collections and bindings in code

3.4.3 ItemsSource bindings in XAML

Summary