Mushfiq
Mushfiq

Reputation: 769

cant change background image of an usercontrol in WP7

I'm developing a windows phone application. I'm new in WP7 app development. In my app I'm using an usercontrol and I have changed it's background image through following process shown in my code. But the background image is not changing. Can anyone help me ? Here is my code snippet :

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

Upvotes: 0

Views: 592

Answers (1)

nucleons
nucleons

Reputation: 742

Set grid background to  

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

Upvotes: 1

Related Questions