Book Image

Apps and Services with .NET 7

By : Mark J. Price
Book Image

Apps and Services with .NET 7

By: Mark J. Price

Overview of this book

Apps and Services with .NET 7 is for .NET 6 and .NET 7 developers who want to kick their C# and .NET understanding up a gear by learning the practical skills and knowledge they need to build real-world applications and services. It covers specialized libraries that will help you monitor and improve performance, secure your data and applications, and internationalize your code and apps. With chapters that put a variety of technologies into practice, including Web API, OData, gRPC, GraphQL, SignalR, and Azure Functions, this book will give you a broader scope of knowledge than other books that often focus on only a handful of .NET technologies. It covers the latest developments, libraries, and technologies that will help keep you up to date. You’ll also leverage .NET MAUI to develop mobile apps for iOS and Android as well as desktop apps for Windows and macOS.
Table of Contents (23 chapters)
22
Index

Using shared resources

When building graphical user interfaces, you will often want to use a resource such as a brush to paint the background of controls or an instance of a class to perform custom conversions. Resources can be defined at the following levels and shared with everything at that level or lower:

  • Application
  • Page
  • Control

Defining resources to share across an app

A good place to define shared resources is at the app level, so let’s see how to do that:

  1. In the Resources folder, in the Styles folder, add a new .NET MAUI Resource Dictionary (XAML) project item named Northwind.xaml.
  2. Add markup inside the existing ResourceDictionary element to define a linear gradient brush with a key of rainbow, as shown highlighted in the following markup:
    <?xml version="1.0" encoding="utf-8" ?>
    <ResourceDictionary xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
                 xmlns...