MVVM, UWP, WPF, Xamarin, DI

Using the MVVM Pattern with XAML-based Apps

For making code reuse and unit tests easy with XAML applications, the MVVM (Model-View-ViewModel) pattern was introduced. This pattern allows for easy code reuse between WPF, the Universal Windows Platform, and Xamarin apps.

This workshop introduces you to the MVVM pattern, and shows what is needed in addtion to the parts of this pattern. You will see connecting Views with ViewModels, scenarios such as Master/Detail views, user input validation, and how different frameworks make use of the MVVM pattern.

Content

  • Introduction to the MVVM Pattern
  • Using Dependency Injection
  • Data Access and Calling Services
  • ViewModels and Views
  • Messaging using Events
  • User Input and Validation
  • Master/Detail Views
  • Navigation
  • Comparision of MVVM Frameworks

Introduction to the MVVM Pattern

Here you learn an introduction of the MVVM pattern including a comparision with the Model-View-Controller (MVC) and Model-View-Presenter (MVP) patterns. Prerequisites that make MVVM possible are data binding and commands, where you learn the foundation about these topics.

Dependency Injection

A dependency injection container such as Microsoft.Extensions.DependencyInjection help with creating independence between multiple platforms. Here you learn about the foundations of dependency injection (or the Hollywood principle) including the use of dependency injection containers.

Data Access and Calling Services

In this part you learn creating a model, calling REST services, using the Repository pattern, caching of data - all what's needed to access a service for using it in the client application.

ViewModels and Views

A view-model is connected to a view. You create views using XAML code, and view-models with C#. The connection between these happens thru data binding. Here you learn creating views and view-models, and different ways how these can be connecte to each other.

Messaging using Events

Sometimes different view-models need to communicate, or a view-model needs to communicate with a view. With such communication it's good to keep the independence of different parties participating with the communication. This is where events come into play.

User Input and Validation

When users enter data, it helps to validate the data before sending it to the server. How data can be validated including undo-functionality is shown here.

Master/Detail Views

Often data needs to be presented in a master-detail manner. Here you learn how this can be done with the MVVM pattern.

Navigation

Different platforms offer navigation between pages on different ways. How navigation is handled often is in conflict with the MVVM pattern. How this can be solved, and also pragmatic variants to make it easy in different scenarios is explained here.

Comparision of MVVM Frameworks

In the workshop you've seen what needs to be implemented by an MVVM Framework. Instead of creating another MVVM Framework, you can use one available. Different MVVM frameworks such as MVVM Light, Prism.Core, and Caliburn.Micro are compared - in the light of using them with WPF, UWP, and Xamarin.

Flexible Content

This workshop is offered as company-based workshop and occasionaly with open course dates. I'm flexible in adapting this workshop to your specific needs. Get in contact to discuss the knowledge you already have and the goals of your project.

Interested in this workshop?