Xaml 如何全局设置应用程序';windows应用商店应用中图像的背景?

Xaml 如何全局设置应用程序';windows应用商店应用中图像的背景?,xaml,windows-store-apps,Xaml,Windows Store Apps,我正在尝试在我的应用程序中将图像设置为背景,现在我知道如何使用 如何在全球范围内做到这一点,有两种方法: 1.将样式添加到资源中,而不使用名称,这样它将应用于该类型的每个元素: <Page.Resources> <Style TargetType="Grid"> <Setter Property="Background"> <Setter.Value> <Im

我正在尝试在我的应用程序中将图像设置为背景,现在我知道如何使用


如何在全球范围内做到这一点,有两种方法: 1.将样式添加到资源中,而不使用名称,这样它将应用于该类型的每个元素:

<Page.Resources>
    <Style TargetType="Grid">
        <Setter Property="Background">
            <Setter.Value>
                <ImageBrush ImageSource="/Assets/SplashScreen.png"/>
            </Setter.Value>
        </Setter>
    </Style>
</Page.Resources>

二,。添加带有名称的样式,并在需要时应用它

<Page.Resources>
<Style x:Key="ImageStyle"  TargetType="Grid">
    <Setter Property="Background">
        <Setter.Value>
            <ImageBrush ImageSource="/Assets/SplashScreen.png"/>
        </Setter.Value>
    </Setter>
</Style>
</Page.Resources>
<Grid Style="{StaticResource ImageStyle}">
</Grid>

有两种方法: 1.将样式添加到资源中,而不使用名称,这样它将应用于该类型的每个元素:

<Page.Resources>
    <Style TargetType="Grid">
        <Setter Property="Background">
            <Setter.Value>
                <ImageBrush ImageSource="/Assets/SplashScreen.png"/>
            </Setter.Value>
        </Setter>
    </Style>
</Page.Resources>

二,。添加带有名称的样式,并在需要时应用它

<Page.Resources>
<Style x:Key="ImageStyle"  TargetType="Grid">
    <Setter Property="Background">
        <Setter.Value>
            <ImageBrush ImageSource="/Assets/SplashScreen.png"/>
        </Setter.Value>
    </Setter>
</Style>
</Page.Resources>
<Grid Style="{StaticResource ImageStyle}">
</Grid>

我按照您的指定更改了StandardStyles.xaml文件中x:Key=“LayoutRootStyle”中的“Background”属性,效果很好,谢谢。我按照您的指定更改了StandardStyles.xaml文件中x:Key=“LayoutRootStyle”中的“Background”属性,效果很好,谢谢