Previously I wrote about how to use reflection to take advantage of Windows Phone 8 tiles on Windows Phone 7. I recommended this for those who want to keep the same code for both version of Windows Phone instead of branching it and making one version for Windows Phone 7 and one for Windows Phone 8. I still recommend this if you aren’t taking advantage of any Windows Phone 8 specific features. This worked fine until today when Microsoft released the Windows Phone 7.8 SDK. 7.8 gives Windows Phone 7.x users the ability to get a variety of tile sizes, and for you, more code reuse. Now you will really get a lot more mileage out of your code since this same code will work for Windows Phone 7.1/7.8/8 if you follow this method.
If you followed the example in my earlier post (which you should) all holds true except one line, the line where you set the targeted version:
You will need to set the above new Version class to 7, 10, 8858 as shown above. This is the major, minor, and build # of Windows Phone 7.8.
You might be tempted to change this value in your WMAppManifest.xml but don’t!
We already set this (in my earlier post) and if you are reading Microsoft’s documentation on Windows Phone 7.8 SDK, it says to set it to the value we already have. Don’t be confused by the AppPlatformVersion of 7.1 . This stays put. If you do change this value you will get the following error when compiling:
Error The ‘AppPlatformVersion’ attribute is invalid – The value ‘8.0’ is invalid according to its datatype ‘http://schemas.microsoft.com/windowsphone/2009/deployment:ST_AppPlatformVersion’ – The Enumeration constraint failed.
Again, if you see the above error it is because you changed the AppPlatformVersion from 7.1 to something else. Read Microsoft’s documentation carefully, it says to change AppPlatformVersion in the AppExtra attribute, not Deployment.
If you made the changes above along with the ones in my earlier post you will see that you can now use the same code base for all 3 versions of Windows Phone! You can create live tiles, one of each size with the content on the flip side you choose.
You can see this in action in my Windows Phone app, Space Weather. I am submitting a new version tomorrow with the said changes above.