Chapter 4, MVVM and Controls
- MVVM has two main advantages. First, it is nearly impossible to unit test a .NET MAUI application if your logic is in the code-behind file – putting the logic in
ViewModel
is essential, as we’ll see in the upcoming chapter on unit testing. Second, MVVM nicely decouples the UI from your logic, allowing you to change one without breaking the other. - The all-important
BindingContext
. You typically assignViewModel
as the binding context forView
. - The
Entry
control and theEditor
control. - The
Label
control. SnackBar
is a highly configurableToast
– a popup that comes up from the bottom of the page and then can disappear either by its timer running out or by a user clicking on it.