Auto sorting listview after item changed RRS feed

  • Question

  • Hi,

    I can't find the way to do this.
    I've already implement sorting columns, and that is working fine... but if i try to call listview.Sort() on ListViewItemChanged event, nothing happens.

    Any ideas?
    Tuesday, August 12, 2008 2:54 PM


All replies

  • There are two things I want to suggest. First, use Refresh with such interventions (before and after sorting, I guess). Secondly you may consider reattaching the DataSource after you sorted.
    Tuesday, August 12, 2008 9:37 PM
  • there's no datasource to reattach.
    Refresh doesn't work either.
    Wednesday, August 13, 2008 12:49 PM
  • You know, about 3 year ago, I recall vaguely, I tried to implement a multicolumn ListView and found if unworkable although it seems I had different problems: the members in the columns clustered in a weird way or something.
    Wednesday, August 13, 2008 3:05 PM
  • Thanks, AlexB, you are always so patient to help other people.

    Hi Matias,

    I found a sample below about how to sort a multi-column listview, when I add a new item, it can be sort automatically, perhaps you can try to refer to it.

    Sorting MultiColumn ListView Windows Forms Control

    And here are also some articles about how to sort listview, you can take a look at them.

    Sorting ListView Items by Column Using Windows Forms

    How to sort a ListView control by a column in Visual C#



    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Thursday, August 14, 2008 10:24 AM
  • Xun, it is a very valuable set of links. Thank you. 
    Thursday, August 14, 2008 12:10 PM
  • Many thanks Xun Ye!
    Best Regards.

    Thursday, August 14, 2008 2:04 PM