我正在尝试为我的 Windows 8 应用商店应用程序定义默认背景颜色,但尽管它在 XAML 编辑器和 Blend 中正确显示,但在 Windows 8 和 Windows RT 模拟器中运行时会出现默认的黑色背景。
我基于“Split App”VS 2012 模板创建了一个全新的 Windows 8 应用程序,并修改了 App.xaml 以指定 ApplicationPageBackgroundThemeBrush 的新值。
这就是我的 App.xaml 的样子:
<Application
x:Class="App3.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App3"
xmlns:localData="using:App3.Data">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- Application-specific resources -->
<x:String x:Key="AppName">App3</x:String>
<!-- Basic foreground and background colours -->
<SolidColorBrush x:Key="ApplicationPageBackgroundThemeBrush" Color="#FF3CA5DC"/>
<SolidColorBrush x:Key="ApplicationPageForegroundThemeBrush" Color="White"/>
</ResourceDictionary>
</Application.Resources>