views:

238

answers:

1

Hi,

I have a ContainerCommand (which is registered in Unity) which calls a web service asynchronously. What I want is the result of the web service to be some how propagated back to the view model and then view. The app is written in Silverlight.

How can I do this?

JD.

+1  A: 

Commands in Caliburn can take parameters. So you might consider passing the ViewModel into the command. Then, the command can update the VM, which in turn updates the View. Chances are, your VM is set to the DataContext, so you could do something like this:

Message.Attach="ContainerCommand MyCommand($dataContext)"

Also, since your command is created via the container, if your VM is also registered in the container as a singleton, you could have the VM injected into the command; then update as above.

EisenbergEffect
Thanks once again Rob. The VM is registered with Unity, so injecting in the model is probably the best way.
JD