I recently needed to rework an existing Xamarin project and replace the MvvmLight implementation with the new Microsoft Mvvm Toolkit. This is generally an easy process and it has been designed as the spiritual successor to Laurent’s library.
One area which had more changes was the Messaging namespace where the app had made use of some built-in messaging types which have no direct equivalent in the Microsoft library. Faced with the issue of further changing the app or simply reimplementing the MvvmLight functionality for the Mvvm Toolkit I chose the latter approach and created an equivalent NotificationMessage class which I’ve put into a Gist in case it is handy for anyone else.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Microsoft.Toolkit.Mvvm.Messaging.Messages | |
{ | |
public sealed class NotificationMessage<T> | |
{ | |
public NotificationMessage(T content, string notification) | |
{ | |
Content = content; | |
Notification = notification; | |
} | |
public T Content { get; } | |
public string Notification { get; } | |
} | |
} |