Xaml 为什么重写ApplicationPageBackgroundThemeBrush不起作用?
我试图为我的Windows8应用商店定义一个默认的背景颜色,但尽管它在XAML编辑器和混合中正确显示,但在Windows8和WindowsRT模拟器上运行时,它会出现默认的黑色背景 我基于“Split app”VS 2012模板创建了一个全新的Windows 8应用程序,并修改了app.xaml,为ApplicationPageBackgroundThemeBrush指定了一个新值 这就是我的App.xaml的样子:Xaml 为什么重写ApplicationPageBackgroundThemeBrush不起作用?,xaml,windows-8,windows-runtime,Xaml,Windows 8,Windows Runtime,我试图为我的Windows8应用商店定义一个默认的背景颜色,但尽管它在XAML编辑器和混合中正确显示,但在Windows8和WindowsRT模拟器上运行时,它会出现默认的黑色背景 我基于“Split app”VS 2012模板创建了一个全新的Windows 8应用程序,并修改了app.xaml,为ApplicationPageBackgroundThemeBrush指定了一个新值 这就是我的App.xaml的样子: <Application x:Class="App3.App" xmln
<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>
附件3
在StandardStyles.xaml中,这两个画笔似乎只用于少数几个样式,其中一个是
您可以将其应用于根面板。但是您在App.xaml中的更改不会影响此样式。它只会影响此笔刷的进一步使用,因此如果您想使用这些特定笔刷,我将看到以下变体:
1) 在App.xml中声明它们,并进一步使用它们,如:
2) 在下面的statardstyles.xaml
中声明它们
在这种情况下,所有标准样式都将受到影响,但您也应该在网格中使用LayoutRootStyle
但实际上,使用这些画笔带来的利润很小,因此我认为最好将面板背景设置为您需要的背景。谢谢您的帮助,Microsoft似乎没有让默认模板特别有用,比如这样,进度条也默认为粉色!