mvvm light - messaging

徘徊边缘 提交于 2019-12-05 01:29:49

I found the following article on the subject. The subject line seems a little unrelated but that link is for part 2 of the article and if you read and scroll down a bit you will find info on the RelayCommand, Messenger, EventToCommand, and ICleanup.

http://www.codeproject.com/KB/silverlight/IssueVisionSilverlightPt2.aspx

Good luck.

I have posted an example of using Messaging here, as part of my Intro to MVVM Light series.

My goal in this example is to send a message indicating that navigation is needed. The VM can't manage the navigation so it sends a message to the view. We do this in three steps:

  1. Create a class to contain the message that is to be passed
  2. In the view model, instantiate the message class and broadcast the message
  3. Within MainPage.xaml.cs register for the message and handle it when received

The complete source code is posted and also available for download.

Mario Levesque

I posted some simple MVVM Light messaging code on this other question with sample compiled code and explanations.

Send a empty Message or Notification with MVVM toolkit light

Cheers, Mario

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!