views:

1260

answers:

2

When you see a details view and click the sort icon in windows, you already get the up and down arrow. How do you implement this is c# for listview?

Also...How do you sort complex times like date fields in a listview?

A: 

Well, in the listview you can shift to the Report view/mode to see the top bars. I've done custom implementation for sorting, i.e. fill the listview again when the sorting buttons are clicked.

I believe there are events for column header clicks. Look them up.

Cyril Gupta
A: 

In order to customize sorting, you need to provide an instance of IComparer that can compare to ListViewItem instances. Assign an instance of this class to the ListView.ListViewItemSorter property to enable custom sorting.

Here is a link to a tutorial on how to accomplish this: http://msdn.microsoft.com/en-us/library/ms996467.aspx

JaredPar