我有一个 WPF ListView,其中有一列包含日期。我想要一种自定义排序日期的方法(按日期值,而不是字符串值)。有没有办法做到这一点?现在我正在使用 list.Items.SortDescriptions 使用另一列进行排序,但我想将其更改为在日期列上排序。
谢谢。
最佳答案
你试过吗?
ICollectionView view = CollectionViewSource.GetDefaultView(listView.ItemsSource);
view.SortDescriptions.Add(new SortDescription("Date", ListSortDirection.Descending));
编辑:您还可以查看 this attached property
关于c# - 按日期排序 ListView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/946475/