Mini-Con
Mini-Con

Reputation: 397

Making TextBox text theme aware

I created a page.i want to change the background of Textbox when theme of emulator is changed to light.The letters cant be visible while changing the themes.is there any solution?

light theme

dark theme

Upvotes: 0

Views: 456

Answers (3)

Mini-Con
Mini-Con

Reputation: 397

We can set a theme as default to our application.When we log in our application the phone theme will be changed to its suitable theme and when we log out change back to original here s the link .

Upvotes: 0

Richard Szalay
Richard Szalay

Reputation: 84744

I assume you are referring to TextBlock rather than TextBox (as the latter automatically has style support).

You should never declare a TextBlock without a Style attribute, such as Style={StaticResource PhoneTextNormalStyle}. A full list of available styles can be found on MSDN: Theme Resources for Windows Phone

Also of relevance is: How to: Apply Theme Resources for Windows Phone

NB: Due to the way Mango was designed, backing into your application after changing themes will not apply the new theme. You will need to restart the application to see the changed theme.

Update

Based on your screenshots, you have two choices:

  • Reskin ("Edit Template" in Blend) each of the controls that you use to redefine a style in which the various colour-related properties are hardcoded
  • Use an alternate, lighter, background image when in the white theme in order to improve the contrast. I've blogged about how you can define theme-aware resources (and also mentioned it on other SO questions).

Put simply, you can either submit to the theme or force it to remain the way you want it.

Upvotes: 1

Paul Diston
Paul Diston

Reputation: 3294

If you use the default TextBox control inside Visual Studio it is fully theme aware. If you have set the colours yourself then you need to perform the theme aware changes in code behind.

For more information, please see the following :-

http://www.developer.nokia.com/Community/Wiki/ThemeawareWindowsPhoneapplication

Upvotes: 1

Related Questions