views:

29

answers:

1

I'm looking to make a border that will serve as a general overlay. I'm trying to use an 800x480 border with opacity .75 as the overlay. However, it only fills the content of the row it's in, not the entire page. If I know how many rows it needs to cover, I can set the rowspan and it will cover the entire screen. I was wondering if there is a way to set it to cover all rows, without knowing how many. Or if there's a better way to accomplish the same thing. The only solution I've come up with so far is to set the rowspan to a big number that I know I won't have (such as 50).

A: 

If you don't set Grid.Row then the border will span all rows. Please notice that Height must be set to 'Auto' and 'VerticalAlignment' to Stretch.

Example:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="*"/>
    <Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="*"/>
    <Grid.ColumnDefinitions>

    <Border Grid.Column="1" Width="Auto" Height="Auto"
            HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
            Background="Red" />

</Grid>

The border will be in the right column and span both rows.

Francesco De Vittori