我怎么能设法根据日期范围做一个列表视图?
有可能做这件事吗?
在 XAML 中:
<ListView>
<ListView.View>
<GridView x:Name="myView">
</GridView>
</ListView.View>
</ListView>
在 YourForm.cs 中
private void CreateColumns()
{
var startDate = new DateTime(2013, 05, 07);
var endDate = new DateTime(2013, 05, 17);
//// Ensure that startDate < endDate, no validation in this example.
var tmp = startDate;
while (tmp <= endDate)
{
GridViewColumn gc = new GridViewColumn();
gc.Header = tmp.ToShortDateString();
gc.Width = 100;
this.myView.Columns.Add(gc);
tmp = tmp.AddDays(1);
}
}