Answered by:
Background Image

Question
-
Sir, I am new in this I tried to put a background image on the main page of my file
by changing Poperties of LayoutRoot by using Background>>image(type icon was there i chose that)>>select file>>FIll
now i have .xaml file also as
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot">
<Grid.Background>
<ImageBrush Stretch="Fill" ImageSource="bg.jpg"/>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>But the problem is image is not getting displayed on visual studio 2010 not even on running the application on emulator OS7.1
Kindly suggest some way out
Monday, February 10, 2014 2:18 PM
Answers
-
This is my code
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot">
<Grid.Background>
<ImageBrush Stretch="Fill" ImageSource="Images/bg.jpg"/>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
</Grid>
</Grid>- Marked as answer by vertika2011 Wednesday, February 12, 2014 11:19 AM
Monday, February 10, 2014 4:52 PM
All replies
-
That looks superficially correct. Do you have other controls on top of the grid covering the image?Monday, February 10, 2014 3:27 PM
-
Hi,
Check whether you have imported the image on the root directory of the project.
If you have stored it in Assets directory, change like this
ImageSource="assets/images.jpg"
For importing your image into your project, you can (right click your project)->Add->Existing Item->browse and select your file .
Pradeep AJ
- Proposed as answer by Pradeep AJ Monday, February 10, 2014 5:01 PM
Monday, February 10, 2014 3:38 PM -
This is my code
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot">
<Grid.Background>
<ImageBrush Stretch="Fill" ImageSource="Images/bg.jpg"/>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
</Grid>
</Grid>- Marked as answer by vertika2011 Wednesday, February 12, 2014 11:19 AM
Monday, February 10, 2014 4:52 PM -
Thanks my problem is solved the problem was the image i downloaded from net ..........
Monday, February 10, 2014 4:59 PM