WP7 行跨度全部

发布于 2024-09-25 04:33:10 字数 211 浏览 1 评论 0原文

我正在寻找一个将作为一般覆盖的边框。我尝试使用不透明度为 0.75 的 800x480 边框作为叠加层。但是,它仅填充其所在行的内容,而不是整个页面。如果我知道它需要覆盖多少行,我可以设置行跨度,它将覆盖整个屏幕。我想知道是否有一种方法可以将其设置为覆盖所有行,而不知道有多少行。或者是否有更好的方法来完成同样的事情。到目前为止,我想出的唯一解决方案是将行跨度设置为一个我知道我不会有的大数字(例如 50)。

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).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

染墨丶若流云 2024-10-02 04:33:10

如果不设置 Grid.Row,则边框将跨越所有行。请注意,高度必须设置为“自动”,“垂直对齐”必须设置为拉伸。

示例:

<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>

边框位于右列并跨越两行。

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.

国产ˉ祖宗 2024-10-02 04:33:10

你是对的。分配一个大于最大行数的任意大的 Grid.RowSpan。 99 似乎可以接受,因为网格中的这么多行可能会出现性能问题。

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

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" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文