tags:

views:

56

answers:

2

I'm new to using SilverLight and I added a grid to the screen, and both sizes are selected to auto, but for some reason it doesn't fill up the screen. I'm using Visual Studio 2010, Silverlight 3.0

I did the exact same thing with two grids earlier and it works perfect

Here's the code:

<Grid Height="75" HorizontalAlignment="Left" Name="grid2" VerticalAlignment="Top" Background="White">
    <Image Height="74" HorizontalAlignment="Left" Name="image1" Stretch="None" VerticalAlignment="Top" Source="test.jpg" />
</Grid>
A: 

Is it just me, you've set the height explicitly in your grid and your image?

I'm no expert, but from my experience if you don't put anything for width it normally fills the parent.

I also notice there are no Row or column definitions, nor are there any Grid.Row, grid.Column dependency properties, is that just something in they way you copied the code?

Doobi
There doesn't have to be explicit Grid.Row or Grid.Column values - they both default to 0, if the Grid has no row or column definitions then it implicitly has 1 row and 1 column (i.e. it has one cell).
slugster
+2  A: 

Setting HorizontalAlignment and VerticalAlignment properties to Stretch and Width, Height to Auto should do the trick.

texmex5