How to avoid theme (lite&dark) efects on windows phone applications? - windows-phone-7

I developed one Windows Phone 7 application.
After installed the app to my mobile device (in emulator too) I'm experiencing the theme problem.
Means there are two themes in windows phone, LITE and DARK.
When I set my theme to dark and execute my app , it looks OK,
but if I change the theme to LITE everything is reverted.
It means white lables become black, and black background become white.
So I need a solution to my app, so that the user can set any theme, but it doesn't effect the appearrence of application.

Don't hardcode colours, brushes, etc, but instead use {StaticResource ResourceName} and use resources from Theme Resources for Windows Phone
Make sure that every TextBlock and TextBox has a Style associated with it (available values from the same link)
If you have have custom resources (colours, images, etc) that you wish to be theme-aware you are free to use the ThemeResourceDictionary I posted on my blog (and also for this SO question). I promise to commit the code to GitHub one of these days and also create a NuGet package.

Related

Enforcing theme for a particular Xamarin application

In my Xamarin project (Xamarin 4.8) there are many pages with complex structure. Also there are many bitmap resources, designed for white backgrounds etc.
When user sets Dark theme on the iOS, appearance of pages become weird and unusable. On Android the application looks as nothing was changed.
For now I have no time, to set manually color properties on every control on every page and I would like to enforce light theme for the application (Android and iOS platforms), to get a time to redesign the whole application later.
In an article I read that Xamarin 5 offers a way, putting this line of code into Application class:
App.Current.UserAppTheme = OSAppTheme.Light;
I tried this way (migrated project to Xamarin 5 and called this code), but it does not work. Application on iOS in the Dark theme looks unusable.
What options do I have on this point? Is there a relatively simple way to enforce Light theme for iOS applications?
As advised by #SushiHangover and #JackHua-MSFT into this answer I used the following approach and it worked (XCode 12.3):
Into the plist.info I should add the key UIUserInterfaceStyle with value Light. And that enforces Light theme for the application, regardless of what theme is set for the device.
Final xml code, that I added to plist.info looks like that:
<key>UIUserInterfaceStyle</key>
<string>Light</string>

Adding custom Button to AppBarButton in Windows Phone 8.1

Just getting into Windows Phone 8.1 development.
I quite like it but I am struggling getting accurate development info.
I am working with the Page.BottomAppBar.
I want to use an png image I have created as one of the buttons.
Does this image I created have to be:
A certain size
A certain format
A certain choice of colors i.e. i can use multiple colors and not just black and white
I am looking to create a 'Login' button you see.
thanks
Please, check the official Microsoft guidelines for app bars for Windows store and guidelines for windows phone. Guidelines cover icons, sizes and formats. It's better to follow them in designing visual style of your app.

How to make or get tile sized Windows Phone vector icons

I am familiar with the standard application icon images that come with the Windows Phone sdk, but I would like to use some of these images as demonstrated on the standard start screen, with the 173x173 dimensions for the application tiles. I've tried resizing these, but they are so blurry they aren't worth using. Is there a place to download the same (or similiar) images that come with SDK except in a larger size?
Also have a look at the Icons8 icon pack, they only ask for a link to their site or $199 without a link
Have a look at Metro Studio by Syncfusion. I use it in all my applications and its free.

How to force to use light theme in Windows Phone 7?

In my Windows Phone 7 app, I want to use the light theme, no matter what theme the user sets in the phone. How to do that ?
Do I need to custom the style or theme ? I just want the default light theme.
Thanks
Jeff Wilcox offers a good way to do this using a theme manager he developed.
http://www.jeff.wilcox.name/2012/01/phonethememanager/
There is a nice way of replacing the default brushes. Saves you setting Forecolor everywhere.
http://www.designersilverlight.com/2011/01/17/theme-forcing-for-windows-phone-7-silverlight/
You'll still need to set the background of the main layout node to the default background brush.
Background="{StaticResource PhoneBackgroundBrush}"
There is no way to force an app to use a specific theme.
The best you can do is create your own style for every control you use and mimic the light theme in your styles.
Beware, this can be a time consuming and tedious task. Be sure to test all pages and all controls in all states when both the light and dark themes have been specified by the user.
I've had to do this (but for the dark theme) and it's not something I'd do again out of choice.
There are a few tips on doing this from one of the PDC sessions on optimising performance http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/10/28/pdc-live-optimizing-performance-for-silverlight-windows-phone-7-applications.aspx
This is a very bad idea.
Windows Phones use OLED displays - the pixels generate light directly, they are not backlit. Power consumption is therefore highest for white pixels. This is why Microsoft is suddenly obsessed with light text on dark backgrounds. It's not a back-to-the-seventies thing.
If you do this you will cause ridiculous power consumption.
For the benefit of the jerk who voted down a factually correct answer, I quote page 63 of the Windows Phone 7 UI Design and Interaction Guide published in July 2010 by Microsoft.
Avoid using too much white in
applications, such as white
backgrounds, as this may have an
impact on battery life for devices
that have organic LED displays.
If you're wondering why Microsoft included a "light background" theme option, so am I.

Making a vb.net application blend in with the Windows theme

Previously I used to piddle around with VB6 to develop a couple of personal projects. Following my upgrade to Windows 7, I've decided to piddle about with vb.net Express Edition 2010.
If I wanted my VB6 application to blend in with the visual style of Windows, I would use the code and techniques described here. In short, I would use a Manifest file and a couple of calls within the application and most of the elements would look similar to the XP theme applied. If it was run on 2000, 95 or 98 then it would look like a standard Windows app. All was good.
Now I've moved onto vb.net, I've written a simple "Hello, world" application but I have absolutely no idea on how to make it look like the Windows 7 theme (eg. the font matches the system font and the widgets are styled correctly).
Just changing the font is a hack and will look out of place on machines that are set-up differently or run a different version of Windows where the default font is different.
How do I ensure my application matches the applied Windows theme irrespective of the version of Windows?
A lot of this is automatic if you create a Windows Forms app. They will (mostly) use the standard native Windows controls which draw themselves with the theme colors. But there are exceptions:
the Form item template uses a default Font named Microsoft Sans Serif. You'll have to change it to Segoe UI to match the Vista/Win7 default. This is only necessary for the Form class, all controls you put on it will automatically inherit that font. On an XP machine, the Windows font mapper will notice that the font is missing and automatically fall back to MSS.
the MenuStrip class uses custom rendering to draw the menu items. It tries to match the Windows style when you change the RenderMode property to System but the way it draws doesn't match the Win7 style. Right-click the toolbox, Choose Items and select MainMenu. That's a legacy version that does use Windows to draw menus so it produces the proper theme appearance.
A very similar problem for ToolStrip. It's legacy version is ToolBar. This is a hard one to swallow, it doesn't use a rebar which make the tool bar look flat and ugly.
There are similar problems in WPF but with the added problem that WPF doesn't use any of the standard Windows controls. And gets it wrong in subtle places.

Resources