I’m using mvvm light to build a Silverlight application.
Is there a code snippet that shows how to access a view model’s property or command from within another view model or user control’s code behind?
I guess it’s simple, but I somehow missed something.
Ueli
You could use the Messenger to do this:
Send the user in the UserViewModel:
would just send the user to anyone interested.
And register a recipient in your CardViewModel:
or you can also send a request from your CardViewModel for shouting the user:
And react on that in the UserViewModel:
(You better use an enum and not a string in a real scenario 🙂 )
Perhabs you can even response directly but I can’t check it at the moment.
Just check this out: Mvvm light Messenger