In this post, Brian Genisio demonstrates how he attaches ViewModels to his Views. And the code to his ViewModelSupport project is available on CodePlex in case you'd like to see how it works along with some examples.
My approach to View-First ViewModel creation has evolved over time. I have constructed ViewModels in code-behind. I have instantiated ViewModels in the resources sectoin of the view. I have used Prism to resolve ViewModels via Dependency Injection. I have created attached properties that use Dependency Injection containers underneath. Of all these approaches, I continue to find issues either in composability, blendability or maintainability.