ViewModel and Interaction Processing (Messenger)

1 minute read


Memorandum of Interpretation of Oreore Part 13

I will summarize Messanger, which is an implementation for interaction processing provided by Livet.


As I introduced at the end of Last time, Livet is one of the MVVM frameworks like Prism.
Livet provides a mechanism called Messanger, which allows you to request interaction from ViewModel without directly referencing the View.
Let’s use this as an alternative to InteractionRequest, which is obsolete in Prism 7.2.

The implementation method is different between Messanger and InteractionRequest. Messanger has one instance itself, and the difference in processing is expressed by the MessageKey specified when notifying from ViewModel. View handles notifications and performs interaction processing by binding Messanger and specifying a value for MessageKey.

Compared to InteractionRequest, Messenger has a cleaner implementation because it can reduce the number of instances. On the other hand, you need to specify the MessageKey as a string, and you may have different tastes in this area.


using Livet.Messaging;

namespace TestApp.ViewModels
    public class MainWindowViewModel
        public InteractionMessenger Messanger { get; }

        public MainWindowviewModel()
            this.Messenger = new InteractionMessenger();

        public void ShowMessage()
            this.Messenger.Raise(new InteractionMessage("ShowMessage"));


<Window x:Class="TestApp.Views.MainWindow"
        <l:InteractionMessageTrigger MessageKey="ShowMessage" Messenger="{Binding Messenger, Mode=OneWay}">

in conclusion

We talked about Livet’s Messager.
Like InteractionRequest, it’s a very versatile mechanism and should provide strong support for MVVM pattern development.