views:

193

answers:

1

I have been trying hours to create a page (Axml) in expression blend that stays in the center of the browser yet equally reduces the white space on either side when the browser window is resized. And example is this site or most decent site on the net. Love a code example or link. Thanks

+1  A: 

After posting this question I immediately worked it out. Ends up being really simple in Silverlight. I was making it hard for myself.

Makte your grid the same size as your layout grid and remove width and height properties for the User Control.

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="SilverlightApplication2.Page"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
>

    <Grid x:Name="LayoutRoot" Background="White" Width="597.5" Height="532">
     <Grid.ColumnDefinitions>
      <ColumnDefinition Width="*"/>
     </Grid.ColumnDefinitions>
     <Grid HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="509" Margin="8.5,0,0,23" Width="579">
      <Rectangle Height="65" Margin="0,8,0,0" VerticalAlignment="Top" Fill="#FFD64141" Stroke="#FF000000" HorizontalAlignment="Stretch"/>
     </Grid>
    </Grid>
</UserControl>