8,757
社区成员
发帖
与我相关
我的任务
分享
ICollectionView dataView =
CollectionViewSource.GetDefaultView(lvxxxx.ItemsSource);
dataView.SortDescriptions.Clear();
SortDescription sd = new SortDescription(列的Header名称, direction);
dataView.SortDescriptions.Add(sd);
dataView.Refresh();
列的Header名称
-》 这个必须是绑定对象中的某个属性。
在 ListView的 GridViewColumnHeader.Click 事件中触发排序方法,这里的Header可以通过事件中的 RoutedEventArgs 参数获取。具体用法自行查询。