Silverlight 无法更改WP7中usercontrol的背景图像

Silverlight 无法更改WP7中usercontrol的背景图像,silverlight,windows-phone-7,grid,Silverlight,Windows Phone 7,Grid,我正在开发一个windows phone应用程序。我是WP7应用程序开发的新手。在我的应用程序中,我使用了一个usercontrol,并通过代码中显示的以下过程更改了它的背景图像。但是背景图像没有改变。有人能帮我吗? 以下是我的代码片段: <Grid> <Image Source="\assests\backgroungimages\appBackground2.jpg" Stretch="UniformToFill"/> <StackPanel x

我正在开发一个windows phone应用程序。我是WP7应用程序开发的新手。在我的应用程序中,我使用了一个usercontrol,并通过代码中显示的以下过程更改了它的背景图像。但是背景图像没有改变。有人能帮我吗? 以下是我的代码片段:

<Grid>
    <Image Source="\assests\backgroungimages\appBackground2.jpg" Stretch="UniformToFill"/>
    <StackPanel x:Name="LayoutRoot"  Width="480" Height="306" Background="Black">
        <TextBlock x:Name="ApplicationTitle" Text="Sign In" Style="{StaticResource PhoneTextNormalStyle}" Foreground="#CBF7FA" FontSize="30"/>
        <toolkit:PhoneTextBox Hint="UserName" Name="txtUsername" Width="auto" HintStyle="{StaticResource HintCustomStyle}"></toolkit:PhoneTextBox>
        <toolkit:PhoneTextBox Hint="Password" Name="txtPassword" Width="auto" HintStyle="{StaticResource HintCustomStyle}"></toolkit:PhoneTextBox>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Button Content="Sign In" Name="btnSignIn" Width="auto" Grid.Column="0" Grid.Row="0">
                <Button.Background>
                    <ImageBrush ImageSource="\assests\backgroungimages\btnImage.jpg" Stretch="UniformToFill"></ImageBrush>
                </Button.Background>
            </Button>
            <Button Content="Cancel" Name="btnCancel" Width="auto" Grid.Column="1" Grid.Row="0">
                <Button.Background>
                    <ImageBrush ImageSource="\assests\backgroungimages\btnImage.jpg" Stretch="UniformToFill"></ImageBrush>
                </Button.Background>
            </Button>
        </Grid>
    </StackPanel>
</Grid>

将网格背景设置为

您是将“BackgroundingImages”文件夹命名错误,还是仅在xaml中命名错误?什么是建造行动不!背景图像目录正常,因为该目录正在为其他页面工作。并且构建操作也设置为resource。我发现很少有像谷歌这样的解决方案,重新启动VS或清理并重新构建解决方案……但它们都不适合我!谢谢你的建议!这是一个很好的参考!
Set grid background to  

<Grid.Background>
   <ImageBrush ImageSource="\assests\backgroungimages\appBackground2.jpg"/>
</Grid.Background>