0

我创建了 XAML,具有网格结构,具有 3 或 4 行,每行包含两列,如果我想为每行和每行和每列周围的边界线设置颜色,我该如何实现它。

我特别是 XAML 中的这个 Ui 创建的新手,关于如何实现这一点的任何想法都会很有用`

                    <TextBlock Foreground="Black"  Text="Account Number :"   Margin="10" Grid.ColumnSpan="2"  />
                    <TextBlock Foreground="Black" x:Name="accNO" Text="" Grid.Column="2" Margin="10"/>

                    <TextBlock Foreground="Black" Text="Currency  :" Grid.Row="1" Margin="10" Grid.ColumnSpan="2" />
                    <TextBlock Foreground="Black" x:Name="accCurr" Text="" Grid.Row="1" Grid.Column="2" Margin="10"/>
                    <TextBlock Foreground="Black" Text="Acount Balance  :" Grid.Row="2" Margin="10" Grid.ColumnSpan="2" />
                    <TextBlock Foreground="Black" x:Name="accOBal" Text="" Grid.Row="2" Grid.Column="2" Margin="10"/>
                    <TextBlock Foreground="Black" Text="Available Balance :" Grid.Row="3" Margin="10" Grid.ColumnSpan="2" />
                    <TextBlock Foreground="Black" x:Name="avBal" Text="" Grid.Row="3" Grid.Column="2" Margin="10"/>

                </Grid>`

我已经更新了获取表格的代码作为我的要求

  <Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" BorderThickness="1" BorderBrush="White">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="1,0" StartPoint="1,1">
                                <GradientStop Color="LightGray" Offset="0" />
                                <GradientStop Color="LightGray" Offset="1" />
                            </LinearGradientBrush>                           
                        </Border.Background>
                        <TextBlock Foreground="Black"  Text="Account Number :"   Margin="10" Grid.ColumnSpan="2"  />
                    </Border>

                    <Border Grid.Row="0" Grid.Column="2" BorderThickness="1" BorderBrush="White">
                        <TextBlock Foreground="Black" x:Name="accNO" Text="" Grid.Column="2" Margin="10"/>
                    </Border>

感谢您的帮助。它是为第一行网格完成的。

4

1 回答 1

2

如果要在每行和每列周围设置边框,请在每行和每列内设置 Border 元素

<Border Grid.Row="2" Grid.Column="1" BorderThickness="1" BorderBrush="White">
    <TextBlock Text="This is some text." />
</Border>
于 2012-09-17T13:31:21.617 回答