August 10, 2010 in Windows Phone 7
Two days ago, Rob Eisenberg released a sample of Caliburn.Micro for Windows Phone 7. I spent a few minutes today creating a Windows Phone 7 Caliburn.Micro project template for Visual Studio 2010 from that project. It should help you get started more quickly on your WP7 projects.
Download and copy the Caliburn.Micro.WP7.zip file to the following directory on your computer: \Documents\Visual Studio 2010\Templates\ProjectTemplates\Silverlight for Windows Phone
Start up Visual Studio and create a new project. You will see an option for Caliburn.Micro (WP7):
After the project is created, you will see the following project structure:
Fix the reference to Caliburn.Micro (download from CodePlex), set a breakpoint in the constructor of MainPageViewModel, and run the application. You will see that when navigation happens to MainPage, that MainPageViewModel is created.
Continue execution to view the app in the emulator:
I like Rob’s idea of doing View-first for pages and ViewModel-first for components on a Page. I have chosen the following naming: MyPage/MyPageViewModel (pages) and MyView/MyViewModel (user controls).