Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

changing to dark in Themeresource for a simple windows app

Recently I have started exploring VS2015 and I went through the basic tutorial of how to create a hello world using c++ in VS2015(https://msdn.microsoft.com/en-us/library/windows/apps/hh974580.aspx).

After copying and building the exact same thing, the background color that I got was light instead of dark like the example shown in the link. I know ThemeResource is responsible for the background color and there are light and dark color scheme.How do you use dark instead of default(light)?

like image 455
GalaxyVintage Avatar asked Jan 21 '26 16:01

GalaxyVintage


1 Answers

In the App.xaml

<Application ...    RequestedTheme="Dark" 

But take care that depending on the version of Windows Preview and the Phone it can be applied or not. In the 10074 it works in previous it does not.

IMPROVEMENT (when you want to change the theme in Runtime):

Suppose you want to change the theme on runtime, if you want to change the Application Current RequestedTheme you cannot but you can do the following:

MainPage.Current.RequestedTheme = ElementTheme.Light;

Apart the Popups won't change the theme as well(Take care about your Window Layout)

Popup.RequestedTheme = ((Window.Current.Content as Frame).Content as Page).RequestedTheme;
like image 181
Juan Pablo Garcia Coello Avatar answered Jan 23 '26 14:01

Juan Pablo Garcia Coello



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!