Forcing theme in windows phone mango won't work
I'm developing an application targeted to Windows Phone 7 Mango release, using the Windows Phone SDK 7.1 Beta 2. I wanted to force the light theme in my application, then I did some research over the internet and found some workarounds, and some tutorials teaching how to import the theme files, with the ResourceDictionary objects, and merge then in the app.xaml, so that I could have some of the theme configurations that I wanted.
Some of the sources where I found this workaround is in the link: http://wp7wonders.wordpress.com/2010/09/19/create-a-theme-for-your-windows-phone-7-application/
Basically, I copied the files under the “C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Design” folder, specifically the System.Window.xaml and the ThemeResource.xaml, to an folder inside my project, and then I did the following in the app.xaml:
...
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/System.Window.xaml"/>
<ResourceDictionary Source="Styles/ThemeResources.xaml"/>
</ResourceDictionary.MergedDictionar开发者_JS百科ies>
</ResourceDictionary>
</Application.Resources>
...
And it didn't work! Then I downloaded the example project in the link, and opened it in the Visual Studio, and the example just worked as expected. I tried very hard to find ANY difference, but the code was equal, then I realized that it could be the version of the SDK and created a new project using the 7.0 version, and it works!
I tried to found any source that could help me to put it to work in the 7.1 version of the SDK but I didn't, then I'm here asking for you help! Please, help me!
The curious is that the preview in the Visual Studio shows the app formated as I want, but the emulator do NOT. I don't know if it's a problem of the emulator itself, or some change in the SDK that would mess up with my realease.
After some aditional research, I found out what looks to be the answer. According to a post by Peter Torr in the MSDN Foruns (http://forums.create.msdn.com/forums/t/86006.aspx), there was a bug in the 7.0 version (?!), so that what I was doing is no more allowed in the 7.1 version of the SDK. As a workaround, he says that someone can use 1) implicit styles, or 2) update the built in styles at runtime.
I'm not sure how I'm gonna implement any of these options, but I think my question was answered.
精彩评论