Hello I got a simple message that I'm trying to deliver between classes:
public class MainVM : ObservableRecipient, IRecipient<SaveMessage>
{
public void Receive(SaveMessage message)
{
Console.WriteLine(message.Value);
}
}
And this code in a different class:
[RelayCommand]
public void SendToDbSave()
{
WeakReferenceMessenger.Default.Send(new SaveMessage(Result.ToString()));
}
Basically the message gets sent, but doesn't get received, the method doesn't get invoked. Any idea why?
try set
IsActive=true.the document explained the IsActive Property:
"It exposes an IsActive property to activate/deactivate the viewmodel. In this context, to "activate" means that a given viewmodel is marked as being in use, such that eg. it will start listening for registered messages, perform other setup operations"