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
  1. Home
  2. General Programming
  3. C#
  4. Selecting/Deselecting items by checking checkboxes in a listview impossible?

Selecting/Deselecting items by checking checkboxes in a listview impossible?

Scheduled Pinned Locked Moved C#
question
7 Posts 4 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.
  • T Offline
    T Offline
    teknolog123
    wrote on last edited by
    #1

    hi, I almost tried everything but couldn't make the listview items be selected when checkbox checked and deselected when unchecked. Am I asking for an impossible thing? Checking the boxes to select is fine but when I uncheck any of the items, all of them are unselected. I didn't eat my brain with more complicated problems but this one will make me do it

    P B 2 Replies Last reply
    0
    • T teknolog123

      hi, I almost tried everything but couldn't make the listview items be selected when checkbox checked and deselected when unchecked. Am I asking for an impossible thing? Checking the boxes to select is fine but when I uncheck any of the items, all of them are unselected. I didn't eat my brain with more complicated problems but this one will make me do it

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      What technology stack? Win forms? ASP.NET? WPF? Silverlight?

      Forgive your enemies - it messes with their heads

      "Mind bleach! Send me mind bleach!" - Nagy Vilmos

      My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

      T 1 Reply Last reply
      0
      • P Pete OHanlon

        What technology stack? Win forms? ASP.NET? WPF? Silverlight?

        Forgive your enemies - it messes with their heads

        "Mind bleach! Send me mind bleach!" - Nagy Vilmos

        My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

        T Offline
        T Offline
        teknolog123
        wrote on last edited by
        #3

        Winfoms.Listview

        M 1 Reply Last reply
        0
        • T teknolog123

          Winfoms.Listview

          M Offline
          M Offline
          Matt U
          wrote on last edited by
          #4

          May I ask why the items must be checked/unchecked AND selected/deselected? What you are witnessing is the default behavior of the ListView. When you check multiple items and select each one, and then you uncheck one, it unchecks all items. Just like if you CTRL+Click to select multiple items and then check ONE of them, they all get checked. I am not certain but perhaps you would need to extend the ListView control yourself?

          djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

          T 1 Reply Last reply
          0
          • M Matt U

            May I ask why the items must be checked/unchecked AND selected/deselected? What you are witnessing is the default behavior of the ListView. When you check multiple items and select each one, and then you uncheck one, it unchecks all items. Just like if you CTRL+Click to select multiple items and then check ONE of them, they all get checked. I am not certain but perhaps you would need to extend the ListView control yourself?

            djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

            T Offline
            T Offline
            teknolog123
            wrote on last edited by
            #5

            Matt U. wrote:

            May I ask why the items must be checked/unchecked AND selected/deselected?

            M 1 Reply Last reply
            0
            • T teknolog123

              hi, I almost tried everything but couldn't make the listview items be selected when checkbox checked and deselected when unchecked. Am I asking for an impossible thing? Checking the boxes to select is fine but when I uncheck any of the items, all of them are unselected. I didn't eat my brain with more complicated problems but this one will make me do it

              B Offline
              B Offline
              BobJanova
              wrote on last edited by
              #6

              Why do you want checkboxes for selection? There is already a perfectly sensible and standard way of multiply-selecting items in a list view.

              1 Reply Last reply
              0
              • T teknolog123

                Matt U. wrote:

                May I ask why the items must be checked/unchecked AND selected/deselected?

                M Offline
                M Offline
                Matt U
                wrote on last edited by
                #7

                I believe you would need some sort of custom control for that, although I am not certain even that would give you exactly what you need. As the last answer stated, why not just use the ListView's selection without checkboxes?

                djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

                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