MVVM light - how to access property in other view model

You could use the Messenger to do this: Send the user in the UserViewModel:

Messenger.Send<User>(userInstance);

would just send the user to anyone interested.

And register a recipient in your CardViewModel:

Messenger.Register<User>(this, delegate(User curUser){_curUser = curUser;});

or you can also send a request from your CardViewModel for shouting the user:

Messenger.Send<String, UserViewModel>("Gimme user");

And react on that in the UserViewModel:

Messenger.Register<String>(this, delegate(String msg)
{
if(msg == "Gimme user")
Messenger.Send<User>(userInstance);
});

(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


Another way is to use the overload of RaisePropertyChanged that also broadcasts the change. You would do this:

RaisePropertyChanged(() => MyProperty, oldValue, newValue, true);

Then in the subscriber:

Messenger.Default.Register<PropertyChangedMessage<T>>(this, Handler);

where T is the type of MyProperty.

Cheers Laurent