Moving to Dark in Themeresource for a simple Windows app

I recently started learning VS2015 and I came across a basic hello world tutorial using C ++ in VS2015 ( https://msdn.microsoft.com/en-us/library/windows/apps/hh974580.aspx ).

After copying and creating the same thing, the background color I got was light and not dark like the example shown in the link. I know the ThemeResource is responsible for the background color and there is a light and dark color scheme. How do you use dark and not the default (light)?

+3


source to share


1 answer


In App.xaml

<Application ...    RequestedTheme="Dark" 

      

But beware that depending on the Windows Preview version and phone, this may or may not be applied. In 10074 he works in the previous mode.

IMPROVEMENT (if you want to change theme in Runtime):



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

MainPage.Current.RequestedTheme = ElementTheme.Light;

      

Besides the pop-ups, the theme will not change either (take care of the window layout)

Popup.RequestedTheme = ((Window.Current.Content as Frame).Content as Page).RequestedTheme;

      

+3


source







All Articles