0

我正在开发一个 Windows Phone 应用程序。我是 WP7 应用程序开发的新手。在我的应用程序中,我使用的是用户控件,并且通过代码中显示的以下过程更改了它的背景图像。但是背景图像没有改变。谁能帮我 ?这是我的代码片段:

<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>
4

1 回答 1

1
Set grid background to  

<Grid.Background>
   <ImageBrush ImageSource="\assests\backgroungimages\appBackground2.jpg"/>
</Grid.Background>
于 2012-05-29T07:52:48.170 回答