Skip to content
Nuvyntra Labs

Documentation

Messaging

IMessageHub: weak subscribe by default, recipient-first handlers, and when to use a command or a service instead.

Messaging

The handler must use the recipient argument so a weak subscribe does not pin the ViewModel. Do not write (msg) => this.Refresh() — that captures this and defeats the weak table.

hub.Subscribe<HomeViewModel, CartChanged>(
    this,
    static (vm, _) => vm.Refresh(),
    weak: true);

Discussion

Comment on Plugin.WinUI.MVVMExpress. The thread lives on this component's GitHub repository (nuvyntralabs/Plugin.WinUI.MVVMExpress). Sign in with GitHub — Giscus uses Discussions, Utterances uses Issues.