【发布时间】:2013-01-31 10:18:51
【问题描述】:
我们有 WPF 应用程序,其中我们是 ListView in One form, 我们想按字母数字顺序订购商品。
当我们对列进行排序时,它需要对字母数字 EG 进行排序
AW1 AW2 AW3
目前正在排序
AW1 AW100 AW2 AW200
那么需要改变什么?
if (lastDirection == ListSortDirection.Ascending)
{
direction = ListSortDirection.Descending;
}
else
{
direction = ListSortDirection.Ascending;
}
还有
// get the sort property name from the column's information.
string sortPropertyName = sortableGridViewColumn.SortPropertyName;
// Sort the data.
Sort(sortPropertyName, direction);
这样的排序函数,
private void Sort(string sortBy, ListSortDirection direction)
{
lastDirection = direction;
ICollectionView dataView = CollectionViewSource.GetDefaultView(this.ItemsSource);
dataView.SortDescriptions.Clear();
SortDescription sd = new SortDescription(sortBy, direction);
dataView.SortDescriptions.Add(sd);
dataView.Refresh();
}
【问题讨论】:
-
我不知道如何检查字母数字,请帮助。
标签: wpf wpf-controls wpfdatagrid wpftoolkit