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. WPF
  4. Updating only visible rows in WPF ListView

Updating only visible rows in WPF ListView

Scheduled Pinned Locked Moved WPF
helpcsharpwpfannouncement
16 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.
  • P Pete OHanlon

    Wow. That sounds like a lot of notifications being fired there (I'm assuming here that you are using INotifyPropertyChanged here). You may want to put some of your processing onto a background thread.

    "WPF has many lovers. It's a veritable porn star!" - Josh Smith

    My blog | My articles | MoXAML PowerToys

    P Offline
    P Offline
    Pankaj Chamria
    wrote on last edited by
    #7

    The processing is actually on a background thread. And the only work that the UI thread is doing is updating itself whenever the INotifyPropertyChanged event is fired for a property. I think with WPF such high frequency of updates is bound to be detrimental to performance. I made a prototype in windows forms and that worked much better under the same load. One more intersting point I observed is that Virtualization is by default true in ListView. Hence making IsVirtualizing = true explicitly, did not have any impact. After trying out many options I am now gonna make use of the good old Thread.Sleep() to add re-curring delays in milliseconds while updating columns of the ListView. Its not an ideal way but i cant figure out anything else:-(

    Pankaj Chamria, Software Programmer.

    K 1 Reply Last reply
    0
    • P Pankaj Chamria

      The processing is actually on a background thread. And the only work that the UI thread is doing is updating itself whenever the INotifyPropertyChanged event is fired for a property. I think with WPF such high frequency of updates is bound to be detrimental to performance. I made a prototype in windows forms and that worked much better under the same load. One more intersting point I observed is that Virtualization is by default true in ListView. Hence making IsVirtualizing = true explicitly, did not have any impact. After trying out many options I am now gonna make use of the good old Thread.Sleep() to add re-curring delays in milliseconds while updating columns of the ListView. Its not an ideal way but i cant figure out anything else:-(

      Pankaj Chamria, Software Programmer.

      K Offline
      K Offline
      Kunal Chowdhury IN
      wrote on last edited by
      #8

      Hi, I am also facing the same issue while populating the huge collection of data in an ObservableCollection & binding it to the UI. Please help me in this case. If you have any code for this, please share that too. Regards, - K

      P 1 Reply Last reply
      0
      • K Kunal Chowdhury IN

        Hi, I am also facing the same issue while populating the huge collection of data in an ObservableCollection & binding it to the UI. Please help me in this case. If you have any code for this, please share that too. Regards, - K

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

        If you're adding large amounts of data, then I would suggest that you consider my implementation of a custom observable collection here[^].

        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

        As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

        My blog | My articles | MoXAML PowerToys | Onyx

        K 1 Reply Last reply
        0
        • P Pete OHanlon

          If you're adding large amounts of data, then I would suggest that you consider my implementation of a custom observable collection here[^].

          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

          As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

          My blog | My articles | MoXAML PowerToys | Onyx

          K Offline
          K Offline
          Kunal Chowdhury IN
          wrote on last edited by
          #10

          Yes... I have seen your link. But, my problem is like Pankaj. I am adding a huge range of data at the first time & then on every second I am modifying the list's item properties. There are more than 10 properties. FYI, I am not adding new items, just modifying the existing data. Due to huge property change in every second, there seems a performance issue as I am binding the data to the UI as UserControls. How can I achieve this? Please help me out. I am using WPF 3.5 SP1.

          P 1 Reply Last reply
          0
          • K Kunal Chowdhury IN

            Yes... I have seen your link. But, my problem is like Pankaj. I am adding a huge range of data at the first time & then on every second I am modifying the list's item properties. There are more than 10 properties. FYI, I am not adding new items, just modifying the existing data. Due to huge property change in every second, there seems a performance issue as I am binding the data to the UI as UserControls. How can I achieve this? Please help me out. I am using WPF 3.5 SP1.

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

            Right, so you're bulk loading data and then modifying the individual items in the list, which results in multiple property changed events being raised. As only a finite amount of these items are being displayed, the first thing I'd do is wrap things up using a Virtualizing StackPanel.

            "WPF has many lovers. It's a veritable porn star!" - Josh Smith

            As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

            My blog | My articles | MoXAML PowerToys | Onyx

            K 1 Reply Last reply
            0
            • P Pete OHanlon

              Right, so you're bulk loading data and then modifying the individual items in the list, which results in multiple property changed events being raised. As only a finite amount of these items are being displayed, the first thing I'd do is wrap things up using a Virtualizing StackPanel.

              "WPF has many lovers. It's a veritable porn star!" - Josh Smith

              As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

              My blog | My articles | MoXAML PowerToys | Onyx

              K Offline
              K Offline
              Kunal Chowdhury IN
              wrote on last edited by
              #12

              I am already using the Virtualizing StackPanel, which loads more than 200 UserControls & displays 100 among them at a time> Each UserControl consists of 10 Properties. Is it require to use the Custom ObservableCollection? Let me know... how I can increase the performance... Share Code if you have one...

              P 1 Reply Last reply
              0
              • K Kunal Chowdhury IN

                I am already using the Virtualizing StackPanel, which loads more than 200 UserControls & displays 100 among them at a time> Each UserControl consists of 10 Properties. Is it require to use the Custom ObservableCollection? Let me know... how I can increase the performance... Share Code if you have one...

                P Offline
                P Offline
                Pankaj Chamria
                wrote on last edited by
                #13

                You seem to be having the same issue as i was with large number of property changed events getting raised.. Here are a few things you can try: 1) Out of all the columns make sure you raise changed events for only those properties that are changing in value. 2) In case you can afford to render the changes once every 1-2 seconds then following the approach given in the below link will be very useful. It solved my performance and UI hanging problems. Try this Link[^] Let me know if this helps.

                Pankaj Chamria, Software Developer.

                K 2 Replies Last reply
                0
                • P Pankaj Chamria

                  You seem to be having the same issue as i was with large number of property changed events getting raised.. Here are a few things you can try: 1) Out of all the columns make sure you raise changed events for only those properties that are changing in value. 2) In case you can afford to render the changes once every 1-2 seconds then following the approach given in the below link will be very useful. It solved my performance and UI hanging problems. Try this Link[^] Let me know if this helps.

                  Pankaj Chamria, Software Developer.

                  K Offline
                  K Offline
                  Kunal Chowdhury IN
                  wrote on last edited by
                  #14

                  Pankaj Chamria wrote:

                  1. In case you can afford to render the changes once every 1-2 seconds then following the approach given in the below link will be very useful. It solved my performance and UI hanging problems.

                  Can you elaborate the solution (if possible, paste the code) as this is very tough to understand a big post from the link you mentioned. :omg: :-D Please share the code to improve the performance for those huge data in the collection. In my case, it is getting hanged, when it is changing the property values. :( Please help. I am waiting for your reply.

                  P 1 Reply Last reply
                  0
                  • K Kunal Chowdhury IN

                    Pankaj Chamria wrote:

                    1. In case you can afford to render the changes once every 1-2 seconds then following the approach given in the below link will be very useful. It solved my performance and UI hanging problems.

                    Can you elaborate the solution (if possible, paste the code) as this is very tough to understand a big post from the link you mentioned. :omg: :-D Please share the code to improve the performance for those huge data in the collection. In my case, it is getting hanged, when it is changing the property values. :( Please help. I am waiting for your reply.

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

                    You may want to take a look at what my friend Tamir came up with here[^].

                    "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                    As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                    My blog | My articles | MoXAML PowerToys | Onyx

                    1 Reply Last reply
                    0
                    • P Pankaj Chamria

                      You seem to be having the same issue as i was with large number of property changed events getting raised.. Here are a few things you can try: 1) Out of all the columns make sure you raise changed events for only those properties that are changing in value. 2) In case you can afford to render the changes once every 1-2 seconds then following the approach given in the below link will be very useful. It solved my performance and UI hanging problems. Try this Link[^] Let me know if this helps.

                      Pankaj Chamria, Software Developer.

                      K Offline
                      K Offline
                      Kunal Chowdhury IN
                      wrote on last edited by
                      #16

                      Pankaj Chamria wrote:

                      1. Out of all the columns make sure you raise changed events for only those properties that are changing in value.

                      I am changing all the properties.

                      Pankaj Chamria wrote:

                      1. In case you can afford to render the changes once every 1-2 seconds then following the approach given in the below link will be very useful. It solved my performance and UI hanging problems.

                      Can you post your code for solving this problem?

                      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