开发者

WP7 Rowspan all

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 t开发者_JS百科hat I know I won't have (such as 50).


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.


You are correct. Assign an arbitrarily large Grid.RowSpan that is greater than the max number of rows. 99 seems acceptable, as you will have likely have performance issues with that many rows in a grid.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜