简体   繁体   English

WP7所有行

[英]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. 我正在尝试使用不透明度为0.75的800x480边框作为叠加层。 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). 到目前为止,我想出的唯一解决方案是将行距设置为一个我不知道的大数字(例如50)。

If you don't set Grid.Row then the border will span all rows. 如果未设置Grid.Row,则边框将跨越所有行。 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. 分配一个任意大的Grid.RowSpan,该值大于最大行数。 99 seems acceptable, as you will have likely have performance issues with that many rows in a grid. 99似乎可以接受,因为网格中的这么多行可能会出现性能问题。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM