9. Graphical User Interfaces

Chapter 1001 2

Stop

Unfinished Chapter!!

I am actively working to complete this eBook, and I haven’t gotten to this chapter yet. In fact, it’s probably just a copy/paste from a similar chapter in my OOP/Java book.

In other words, don’t read this yet!

What’s the Point?

* *

Source code examples from this chapter and associated videos are available on GitHub.


9.1. Graphical User Interfaces

Until now, we’ve been creating console applications, in which the entire user interface is text-based. Though many utility applications are text-based, those are generally used by "power users," software developers, and system administrators. End users are used to applications that rely graphical elements to interact with the user. This is called a graphical user interface, which is abbreviated as GUI and pronounced "gooey."

GUIs on desktop and laptop computers have elements like windows, buttons, text fields, and checkboxes, and the user interacts using a mouse or touchpad. On mobile devices, GUIs use similar elements—such as buttons, sliders, lists, and text boxes—but are designed for touch input with taps and swipes instead of clicks. These GUI elements are called widgets or controls.

Time To Watch!

Intro to GUIs

9.2. The .NET MAUI Framework

The code required to create and display a functioning GUI is complex and far beyond our current skills, but we can use pre-built GUI components written by other developers. These are typically bundled into libraries, or frameworks, that we can use in our own programs. Beginning C# students often start with a framework called Windows Forms. However, Windows Forms is an older technology focuses, not surprisingly, on Windows application development.

There are a few options for a more modern framework, but a popular choice that is part of the .NET development ecosystem is called MAUI (Multi-platform Application User Interface). MAUI lets you design apps that can run on Windows, macOS, iOS (and IPadOS), and Android.

9.2.1. Installing .NET MAUI

If it is not already installed, you will need to install .NET MAUI.

You can develop MAUI applications with any of the IDEs recommended in Selecting an IDE at the start of this book. However, VS Code’s support for .NET MAUI is still fairly new and, in my opinion, not as user friendly. Therefore, this might be a good time to try Visual Studio Community (Windows only, see Installing Visual Studio Community) or JetBrains Rider (Windows and macOS, see Installing the .NET SDK and JetBrains Rider).

Most—if not all—of my own videos will use the Rider IDE, since it is cross-platform and available to all students.

The following links explain how to configure your IDE and create your first .NET MAUI application.

9.3. Creating Our First .NET MAUI Application


Check Yourself Before You Wreck Yourself (on the assignments)

Chapter Review Questions

1.

2.

3.

Sample answers provided in the Liner Notes.