Using InitParams with MVVM Light

If I use the MVVM light template (SL4) I find the mainviewmodel (mainviewlocator) is created before App.Aplication_Startup has been executed; therefore any initparams passed to silverlight are not present at createtime.

What are the recommended workflow for this scenario (I need various values from the hosting (asp) application, before the viewmodel is created)

The ViewModelLocator is created very early, but nothing forces you to create the ViewModels in the ViewModelLocator's constructor. Instead, add a "Create" method, which takes the HTML parameters as argument, and pass these arguments to the MainViewModel's
constructor.

This is the main advantage of the ViewModelLocator pattern: You have total control over the viewmodels' lifetime.