I want to sort the items inside column of ListView, i already made it, but... i can\'t made it with the type of data in column (see picture), someone knows the way for do it
Have you tried what Microsoft has to say for this task? Basically, you'll have to implement a custom comparer, and handle ColumnClick
event. But since items in listview are stored as strings, you'll most likely need to do some parsing (assuming you want to sort by size), or implement workaround - sorting datasource and reasign items (which may be easier).
Quick example of pseudocode for workaround (as implementing custom comparers with parsing from string involved seems too cumbersome for such simple task). In ColumnClick
event handler, you could do this:
// I assume you got list of raw dll sizes somewhere
dllSizes.Sort();
List dllSizesForDisplay = new List();
foreach (var dll in dllSizes)
{
dllSizes.Add(new ListViewItem(GetSize(dll.Bytes)));
}
// reasign items
listView.Items.Clear();
listView.Items.AddRange(dllSizesForDisplay);