【发布时间】:2014-08-03 13:57:44
【问题描述】:
我正在开发 windows phone 8.1 应用程序,当我为 hubpage.xaml 设置背景图像时,它不会影响 itempage.xaml。谁能帮我为应用程序中的所有其他页面设置相同的背景?无论如何,我正在使用集线器模板。
【问题讨论】:
标签: c# xaml windows-phone-8 windows-phone-8.1
我正在开发 windows phone 8.1 应用程序,当我为 hubpage.xaml 设置背景图像时,它不会影响 itempage.xaml。谁能帮我为应用程序中的所有其他页面设置相同的背景?无论如何,我正在使用集线器模板。
【问题讨论】:
标签: c# xaml windows-phone-8 windows-phone-8.1
这是因为您的 xaml 上的属性是特定于页面的。
如果您想使用相同的背景,您可以在 xaml 中手动为每个页面分配背景(请参阅 HubPage.xaml 的 Hub 部分的 Background 属性。
或者您可以覆盖您的ApplicationPageBackgroundThemeBrush 并将其设置为您想要的背景。
编辑您的 App.xaml 并向 ResourceDictionary 添加一个新条目。
<ResourceDictionary x:Key="Default">
<ImageBrush x:Key="HubBackgroundImageBrush" ImageSource="Assets/HubBackground.png"/>
<ImageBrush x:Key="ApplicationPageBackgroundThemeBrush" ImageSource="Assets/HubBackground.png"/>
</ResourceDictionary>
【讨论】: