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. Items in ListView changed [modified]

Items in ListView changed [modified]

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

    Is there an event that raise if the collection of ListViewItems in the ListView has been changed?

    modified on Tuesday, February 19, 2008 11:22 AM

    L D 2 Replies Last reply
    0
    • C C Scharbe

      Is there an event that raise if the collection of ListViewItems in the ListView has been changed?

      modified on Tuesday, February 19, 2008 11:22 AM

      L Offline
      L Offline
      LongRange Shooter
      wrote on last edited by
      #2

      Looking at the documentation it appears that you do not have such an event. But since the ListView can take a list of objects, you can have your objects either expose an event or a IsDirty property to indicate if values have changed within them.

      1 Reply Last reply
      0
      • C C Scharbe

        Is there an event that raise if the collection of ListViewItems in the ListView has been changed?

        modified on Tuesday, February 19, 2008 11:22 AM

        D Offline
        D Offline
        DaveyM69
        wrote on last edited by
        #3

        Do you mean the collection being changed (i.e. an item added) or an item in the collection? If the first then not specifically for an Item(s) being added. The Invalidated event is raised but it's raised for other things too so may not be useful. You could create your own class that inherits from ListView.ListViewItemCollection and override the Add method and raise your own event in there, or simply create your own event elsewhere and raise it every time you call the Add or AddRange methods. You may need to do the same for the remove methods and clear methods as well.

        Dave

        C 1 Reply Last reply
        0
        • D DaveyM69

          Do you mean the collection being changed (i.e. an item added) or an item in the collection? If the first then not specifically for an Item(s) being added. The Invalidated event is raised but it's raised for other things too so may not be useful. You could create your own class that inherits from ListView.ListViewItemCollection and override the Add method and raise your own event in there, or simply create your own event elsewhere and raise it every time you call the Add or AddRange methods. You may need to do the same for the remove methods and clear methods as well.

          Dave

          C Offline
          C Offline
          C Scharbe
          wrote on last edited by
          #4

          I also tried to inherit an own class from ListViewItemCollection and raise a Changed event if any item were added or removed, but i don't know how to set the inherited class to the ListView.Items collection. Therefore i inherit an own ListView2 from the ListView class and tried to set the Items: base.Items = new ListViewItemCollection2(); But base.Items is readonly...

          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