在mvvm light toolkit中使用参数发送消息的问题

时间:2011-09-05 13:00:53

标签: silverlight-4.0 mvvm-light

我已经注册了两条消息:

  Messenger.Default.Register<NotificationMessage<DriverEventItem>>(this, NotificationMessageReceived);

Messenger.Default.Register<NotificationMessage>(this,NotificationMessageReceived);

我有两种处理此消息的方法:

private void NotificationMessageReceived(NotificationMessage<DriverEventItem> msg)
{
//something
}

private void NotificationMessageReceived(NotificationMessage msg)
{
//something
}

但是这个

var nm=new NotificationMessage(this.SelectedShowroomLog.DriverEventItem,"ShowView2");

Messenger.Default.Send(nm);

调用第二个处理程序。

如何正确地将此驱动项目发送给收件人?

1 个答案:

答案 0 :(得分:0)

这很简单:)

NotificationMessage(this.SelectedShowroomLog.DriverEventItem “ShowView2”)