Messenger -"Register" an instance and not a type with the MVVM Light Toolkit?

Posted by vidalsasoon on Stack Overflow See other posts from Stack Overflow or by vidalsasoon
Published on 2010-05-08T14:28:23Z Indexed on 2010/05/08 14:38 UTC
Read the original article Hit count: 203

Filed under:

Hello i'm consfused using the Messenger class of MVVM Light.

I have a ProductsViewModel that can get initialized a number of times.

In the constructor of ProductsViewModel I have this code:

Messenger.Default.Register(this, n => MessageBox.Show(n.Test));

The problem is, if I have 2 instances of ProductsViewModel, then Messenger gets registered twice.

Is is bad to Register the Messenger in a constructor?

Hope this makes sense!

© Stack Overflow or respective owner

Related posts about mvvm-light