WPF VirtualizingStackPanel for increased performance

后端 未结 2 1989
北荒
北荒 2020-11-28 23:52

I would like a simple description of how to implement a virtualizingstackpanel for an ItemsControl that is databound to an ObservableCollection in

相关标签:
2条回答
  • 2020-11-29 00:21

    There are two techniques that might be a big help. Both of them are described very well by Bea Stolnitz on her blog.

    The first is UI Virtualization and the second is Data Virtualization

    In UI virtualization you use things like VirtualizingStackPanel to make the UI draw fewer things.

    Data virtualization makes sure you don't bring a million objects into memory when you are only going to show 100.

    So UI virtualization minimizes the number of things drawn and data virtualization minimizes the number of things that could be drawn.

    Hope that helps

    0 讨论(0)
  • 2020-11-29 00:33

    I had exact the same problem ind WPF using TabControl and DataGrid. By growing DataGrid element size, switching tabs becomes VERY slow ! After that I found this post reading the blog from Bea Stolnitz as supposed by the previous answer. That gave me the hint to google "wpf tabcontrol VirtualizingStackPanel" which gives me the link to DrWPF: http://groups.google.com/group/wpf-disciples/browse_thread/thread/6f3531a1720252dd

    He describes exactly the problem and gives the solution :-))

    .... The perf hit is during the building of the tree. Unfortunately, if
    you're using a typical MVVM approach with a binding on the ItemsSource
    property of the TabControl, the entire tree must be rebuilt each time
    a tab item is selected. This is usually a very expensive operation. ....

    0 讨论(0)
提交回复
热议问题