I definitely think you should use the MVVM template for Silverlight applications, and one of the advantages of the template is that you can really make your application really mixed with simple methods. I often refer to “compatibility” as “design for convenience” - you use certain methods to make sure your application looks great in Blend.
One of the methods, as Thorbjørn points out, is to use the dependency injection platform and provide various implementations of your external services depending on whether the code is executed in Blend or in the browser. Therefore, I configure my container to use a dummy data provider when the code runs in Blend, and this way you get development-time support for your lists, data grid, etc.
The problem is how to declare the DataContext declaratively - so I often end up using the front-end services locator class a in the IoC container. That way I can bind the data context to a property in the service locator.
Another method is to create some kind of ObjectDataSource control (not visual) that has two properties: Design Time DataContext and RunTime data context. The control performs the task of determining the location of execution, and then sets the parent DataContext to the correct object.
Jonas Follesø Dec 19 '08 at 9:21 2008-12-19 09:21
source share