Silverlight simple data binding 2, silverlight binding
<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>
If <stacpanel> is not used for local layout in the previous article, the three rows of data will overlap. Here, the second method is to divide the layout page into rows and then fill in the data in the specified columns. ShowGridLines = "False" False: no split line exists on the layout page, and the true layout also has a split line.