Using WP7 Controls in Silverlight Desktop
In building my WP7 apps I have taken the approach of dual coding wherever possible, that is to say that each solution has both a standard Silverlight project and a Windows Phone 7 project, with shared code (using shortcuts within the project) wherever possible. My objective is to have the Silverlight Desktop version mimic the UI and behavior of the WP7 project.
Windows Phone 7 has a few new controls but a little digging (and I mean just a little) reveals that they are in fact standard controls with a style applied within the APP.XAML of the WP7 project. SO it is simple a case of cutting and pasting the styles from the WP7 to the Desktop project!
For an example of the new toggle switch applied to a silverlight desktop project click on the options button in the top left corner of the following link:
So the code for the checkbox within the options panel simply has the following style applied to it:
This is also useful when doing multi-touch desktop applications as the styles for all the WP7 controls provide a better staring point than the default desktop equivalents.