在WPF数据网格中排序问题 [英] Sorting Issue in WPF Data Grid

查看:85
本文介绍了在WPF数据网格中排序问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个带有对象列表的网格作为数据源 - 非常基础。我还需要添加2个始终固定的列。因此,当用户对对象列表中的一列进行排序时,这两列永远不会排序。类似于选择排序范围后在Excel中排序。



示例:



ABCD
L 1 16.1 12/2/2012

L 2 17.4 3/14/2011

R 3 8.2 5/15/2012

R 4 9.0 10/19/2012



不确定上面的网格会出现多少,但是我需要A列和B列始终保留在用户对列C和D进行排序时的顺序。列C和D将一起排序

I need to create a grid with a list of objects as the datasource -- very basic. I also need to add 2 columns that are always fixed. So when the user sorts on one of the columns from the list of objects these 2 columns never sort. Similar to a Sort in Excel after selecting the sort range.

Example:

A B C D
L 1 16.1 12/2/2012
L 2 17.4 3/14/2011
R 3 8.2 5/15/2012
R 4 9.0 10/19/2012

Not sure how well the above grid will show up, but I need columns A and B to always remain in that order while the user sorts columns C and D. Columns C and D will sort together

推荐答案

看起来你需要一个自定义排序算法,所以看看这里:

http://www.zagstudio.com/blog/441#.UU3IDjetqDw [ ^ ]



虽然我的问题可能不对。
Seems like you need a custom sorting algorithm, so have a look here:
http://www.zagstudio.com/blog/441#.UU3IDjetqDw[^]

Although I might got your question wrong.


这篇关于在WPF数据网格中排序问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆