Skip to main content

Wiki WPF

GitHub - SingletonSean/wpf-tutorials: Tutorial source code for WPF concepts.

GitHub - liviaerxin/WPF-MVVM-EFC-Example: 📲 MVVM (WPF) application built with EFCore, Abstract Factory pattern and dependency injection (Microsoft Unity)

MVVM​

MVVM Pattern Made Simple - CodeProject

MVVM in Depth - CodeProject

My attempt to understand MVVM pattern and questions raised during it : csharp

Patterns - WPF Apps With The Model-View-ViewModel Design Pattern | Microsoft Docs

Introduction to the MVVM Toolkit - Windows Community Toolkit | Microsoft Docs

Features​

  • IoC, Inversion of Control
  • DI, Dependency Injection
  • Navigation
  • ViewModel-to-ViewModel Communication
  • Observable Object in ViewModel
    • Wrapping a non-observable model

      // https://docs.microsoft.com/en-us/windows/communitytoolkit/mvvm/observableobject#wrapping-a-non-observable-model
      public class ObservableUser : ObservableObject
      {
      private readonly User user;mvvm-application.png

      public ObservableUser(User user) => this.user = user;

      public string Name
      {
      get => user.Name;
      set => SetProperty(user.Name, value, user, (u, n) => u.Name = n);
      }
      }

Principles​

MVVM Application

  • View-to-ViewModel one-to-one/many-to-one mapping
  • ViewModel-to-ViewModel communication
  • ViewModel-to-Model one-to-one/one-to-many binding

Access Database​

DAO or Repository

Entity DB Context

ReactiveUI​

To property - pasoft-share/ReactiveUI

One of the core features of ReactiveUI is to be able to convert properties to Observables, via WhenAny , and to convert Observables into Properties, via a method called ToProperty . These properties are called Output Properties in ReactiveUI, and they are a huge part of using the framework effectively.