mvvm light - messaging
I'm curently teaching myself the MVVM pattern. I've hit my first snag with the concept of messaging. I know 开发者_StackOverflow社区messaging is contained in the mvvm-light toolkit. But I cannot find an example of usage anywhere (no sample projects are provided in the download).
If anyone can direct me to some information as to how to use messaging in that toolkit, that would be ace.
Thanks
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:
- Create a class to contain the message that is to be passed
- In the view model, instantiate the message class and broadcast the message
- Within MainPage.xaml.cs register for the message and handle it when received
The complete source code is posted and also available for download.
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.
http://blog.galasoft.ch/archive/2009/09/27/mvvm-light-toolkit-messenger-v2-beta.aspx
Here abit about it.
/Bo
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
精彩评论