我是WPF控件的新手。我需要输出如下图所示。下面的代码是WPF Grid的输出。我想为n no.of重复网格标题。倍。基于用户选择的日期范围。 任何人请告诉我如何动态实现这一点
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0">
<TextBlock Grid.Column="1" Text="P2L3" TextAlignment="Center" />
</Border>
<Border Grid.Column="1">
<TextBlock Grid.Column="1" Text="P1L2" TextAlignment="Center" />
</Border>
<Border Grid.Column="2">
<TextBlock Grid.Column="1" Text="P2L3" TextAlignment="Center" />
</Border>
<Border Grid.Column="3">
<TextBlock Grid.Column="1" Text="P1L2" TextAlignment="Center" />
</Border>
</Grid>
<Grid Grid.Row="4">
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0">
<TextBlock Grid.Column="1" Text="GEN3" TextAlignment="Center" />
</Border>
<Border Grid.Column="1">
<TextBlock Grid.Column="1" Text="GEN3" TextAlignment="Center" />
</Border>
<Border Grid.Column="2">
<TextBlock Grid.Column="1" Text="GEN3" TextAlignment="Center" />
</Border>
<Border Grid.Column="3">
<TextBlock Grid.Column="1" Text="GEN3" TextAlignment="Center" />
</Border>
</Grid>
</Grid>
可以建议我动态编写它,输出将使用代码重复n次。 即相同的标题按日期更改。 我的最终输出将如下