Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Listview sorting by group of items

Listview sorting by group of items

Scheduled Pinned Locked Moved C#
algorithmstutorial
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fady_sayegh
    wrote on last edited by
    #1

    Hi all, i need to sort a listview based on the item tag property (as a category) in fact, the listview is populated with a folder content from windows explorer. when i click on the column header, i need to sort by name the folders and the after the files Example : the desired result MyFolder YourFolder MyFile YourFile instead of MyFile MyFolder YourFile YourFolder thanks for any idea, snippet code or a link best regards Fady Sayegh

    L D R 3 Replies Last reply
    0
    • F fady_sayegh

      Hi all, i need to sort a listview based on the item tag property (as a category) in fact, the listview is populated with a folder content from windows explorer. when i click on the column header, i need to sort by name the folders and the after the files Example : the desired result MyFolder YourFolder MyFile YourFile instead of MyFile MyFolder YourFile YourFolder thanks for any idea, snippet code or a link best regards Fady Sayegh

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      The ListView class has, oh surprise, a Sort method. It offers a default sorting order, however it also provides a custom sorting order. MSDN holds the essential information, and one of my articles (see link in sig) deals with sorting in general, it does not mention ListView in particular. :)

      Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

      F 1 Reply Last reply
      0
      • L Luc Pattyn

        The ListView class has, oh surprise, a Sort method. It offers a default sorting order, however it also provides a custom sorting order. MSDN holds the essential information, and one of my articles (see link in sig) deals with sorting in general, it does not mention ListView in particular. :)

        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

        F Offline
        F Offline
        fady_sayegh
        wrote on last edited by
        #3

        Hi Luc, thanks for your quick answer. can you please provide me the link to your article. sorry but i have clicked on the link [My Articles] but i didn't find any article about sorting issues can you please redirect me to the right url. thanks again for your help Best regards Fady Sayegh

        L 1 Reply Last reply
        0
        • F fady_sayegh

          Hi Luc, thanks for your quick answer. can you please provide me the link to your article. sorry but i have clicked on the link [My Articles] but i didn't find any article about sorting issues can you please redirect me to the right url. thanks again for your help Best regards Fady Sayegh

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          just enter sorting and click the find button, that should do it. :)

          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          L 1 Reply Last reply
          0
          • L Luc Pattyn

            just enter sorting and click the find button, that should do it. :)

            Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Well your title "Sorting a Collection" only gives a small clue. ;)

            I must get a clever new signature for 2011.

            L 1 Reply Last reply
            0
            • L Lost User

              Well your title "Sorting a Collection" only gives a small clue. ;)

              I must get a clever new signature for 2011.

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              Yeah, I spend most of my time searching for catchy, unexpected and mysterious titles, and yet I often fail at it. :)

              Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

              Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

              1 Reply Last reply
              0
              • F fady_sayegh

                Hi all, i need to sort a listview based on the item tag property (as a category) in fact, the listview is populated with a folder content from windows explorer. when i click on the column header, i need to sort by name the folders and the after the files Example : the desired result MyFolder YourFolder MyFile YourFile instead of MyFile MyFolder YourFile YourFolder thanks for any idea, snippet code or a link best regards Fady Sayegh

                D Offline
                D Offline
                Dalek Dave
                wrote on last edited by
                #7

                Seriously? see here[^] There has always been a sort in list view. It is amazing that you are asking such a fundamental question.

                ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] Trolls[^]

                1 Reply Last reply
                0
                • F fady_sayegh

                  Hi all, i need to sort a listview based on the item tag property (as a category) in fact, the listview is populated with a folder content from windows explorer. when i click on the column header, i need to sort by name the folders and the after the files Example : the desired result MyFolder YourFolder MyFile YourFile instead of MyFile MyFolder YourFile YourFolder thanks for any idea, snippet code or a link best regards Fady Sayegh

                  R Offline
                  R Offline
                  RaviRanjanKr
                  wrote on last edited by
                  #8

                  In addition to Dalek Dave answer I am suggesting you to read these article [ Link1[^] and Link2[^] ] for more information

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups