开发者

Infragistics ValueList Sort

Scenatio is as follows:

I have a value-list which is of Type "Infragistics.Win.ValueList". and I want to sort the value-list. Let say I have the following values in Value-list.

"Value 1" "Value 3". "Value 2" "Value 11" "Value 22"

I'm using "value-list.SortStyle = ValueListSortStyle.Ascending;" to sort the value-list in ascending order. The output is as follo开发者_开发百科ws:

"Value 1" "Value 11" "Value 2" "Value 22" "Value 3".

This is becasue the sorting is based on string, where as the desired output is

"Value 1" "Value 2" "Value 3" "Value 11" "Value 22".

Also, ValueList doesn't expose the SortComparer property, so that I can write custom sort.

What should be my approach to get the desired output?


Is there another property associated to each of your values? There are 'Value' and 'Text' properties on the value lists so if you could find something that sorts better to put in the 'Value' column I guess that might be ideal?

If not you could probably use an UltraDropDown / UltraCombo instead of a value list. They are like mini UltraGrids so you should be able to apply the custom sort to one of those the same as you would on a grid (not 100% sure but I don't have Infragistics on this computer so I'll check at work tomorrow).


I have found a solution though. It is definately not the best solution, but its giving me the desired output. Here it is.

After the values are stored in the value list I'm assinging the assinging all the values to a ArrayList(only the Text property). Then I'm sorting the ArrayList, which exposes the SortComparer property.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜