Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mvvm light - messaging

Tags:

mvvm-light

I'm curently teaching myself the MVVM pattern. I've hit my first snag with the concept of messaging. I know 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

like image 568
onefootswill Avatar asked Dec 13 '10 07:12

onefootswill


1 Answers

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.

like image 190
Jesse Liberty Avatar answered Jan 04 '23 01:01

Jesse Liberty