<Grid x:Name="LayoutRoot" Background="white" Loaded="LayoutRoot_Loaded" ShowGridLines="False"> <Grid.RowDefinitions> <RowDefinition Height="40"></RowDefinition> <RowDefinition Height="40"></RowDefinition> <RowDefinition Height="40"></RowDefinition> <RowDefinition Height="40"></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="80"></ColumnDefinition> <ColumnDefinition Width="50"></ColumnDefinition> <ColumnDefinition Width="50"></ColumnDefinition> <ColumnDefinition Width="50"></ColumnDefinition> </Grid.ColumnDefinitions> <TextBlock Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" Text="{Binding Name}"/> <TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" Text="{Binding Age}"/> <TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" Text="{Binding Address}"/> </Grid>
针对上篇 若不使用<stacpanel>进行局部布局则三行数据会重叠,这里第二种方法是先把布局页面划分好行列,然后在指定的行列填数据。 ShowGridLines="False" False 布局页无分割线, ture布局也有分割线