如何强制Windows Phone 8应用程序以轻主题运行

Kul*_*ngh 10 c# windows-phone-8 windows-phone-8-emulator

我已经开发了一个Windows手机应用程序,我希望该应用程序以轻主题运行,无论用户设置了什么.意味着有没有办法为Windows Phone 8应用程序设置默认主题.

Ant*_*kov 15

你可以使用Jeff Wilcox的 ThemeManager

将它添加到您的项目(有一个NuGet包可用)并从App()构造函数中调用它.

public App()
{
    // Global handler for uncaught exceptions.
    UnhandledException += Application_UnhandledException;

    // Standard Silverlight initialization
    InitializeComponent();

    // Phone-specific initialization
    InitializePhoneApplication();

    ThemeManager.ToLightTheme();

    // Other code that might be here already...
}
Run Code Online (Sandbox Code Playgroud)

您可以在他的网站上找到用法示例.


Oua*_*die 7

对于Windows Phone 8.1,您可以使用:

<Application
    x:Class="App26.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    RequestedTheme="Light"
    xmlns:local="using:App26">
</Application>
Run Code Online (Sandbox Code Playgroud)

要么

public App()
    {
        this.RequestedTheme = ApplicationTheme.Light;

        this.InitializeComponent();
        this.Suspending += this.OnSuspending;
    }
Run Code Online (Sandbox Code Playgroud)

来源:Windows phone 8即使手机的主题发生变化,如何始终使用一个主题