Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
.NET MAUI for C# Developers

You're reading from   .NET MAUI for C# Developers Build cross-platform mobile and desktop applications

Arrow left icon
Product type Paperback
Published in Mar 2023
Publisher Packt
ISBN-13 9781837631698
Length 296 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Rodrigo Juarez Rodrigo Juarez
Author Profile Icon Rodrigo Juarez
Rodrigo Juarez
Jesse Liberty Jesse Liberty
Author Profile Icon Jesse Liberty
Jesse Liberty
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Part 1 – Getting Started
2. Chapter 1: Assembling Your Tools and Creating Your First App FREE CHAPTER 3. Chapter 2: What We Will Build: Forget Me Not 4. Chapter 3: XAML and Fluent C# 5. Chapter 4: MVVM and Controls 6. Chapter 5: Advanced Controls 7. Chapter 6: Layout 8. Part 2 – Intermediate Topics
9. Chapter 7: Understanding Navigation 10. Chapter 8: Storing and Retrieving Data 11. Chapter 9: Unit Testing 12. Part 3 – Advanced Topics
13. Chapter 10: Consuming REST Services 14. Chapter 11: Exploring Advanced Topics 15. Assessments 16. Index 17. Other Books You May Enjoy

Managing Visual State

Every VisualElement has a Visual State at any given moment (for example, does VisualElement have focus? Is it selected?). You can imagine responding to that state programmatically in C#, but there are advantages to responding to changes in visual state declaratively, in the XAML. Doing so puts more of the UI management in one place – your view (for example, MainPage.xaml).

VisualElement

VisualElement is the base class of all controls (and pages).

The object that sets visual properties on VisualElement based on its state is the Visual State Manager. The Visual State Manager selects from among a set of VisualStates and displays a VisualElement according to the properties set in the XAML.

This forces the question: what are visual states?

Defining the common visual states

.NET MAUI defines a set of common visual states:

  • Normal
  • Disabled
  • Has focus
  • Is selected
  • Mouse over (for Windows and macOS)

.NET MAUI also allows...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image