简体   繁体   English

如何仅对网格的一行进行着色?

[英]How to color only one row of a grid?

I'm creating small browser as user control. 我正在创建小型浏览器作为用户控件。 I want to colour only one row because i'm moving address bar to bottom of grid. 我只想上色一行,因为我要将地址栏移到网格底部。 I tried to change Background in RowDefinitions but there isn't such property in XAML. 我试图在RowDefinitions更改Background ,但是XAML中没有这样的属性。

So how to do that? 那么该怎么做呢?

That is correct, you are not supposed to set a background in RowDefinitions. 没错,您不应该在RowDefinitions中设置背景。 You could for example use a Grid to do that. 例如,您可以使用网格来做到这一点。

Here is a small example: 这是一个小例子:

    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>

      <Grid Grid.Row="0"
          Background="AliceBlue" />
    </Grid>

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

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