6

Following this question and this question, now I have a TreeView with Hierarchical Data like the picture below:

enter image description here

Because of the big amount of data, I have turned Virtualization property of the TreeView on (VirtualizingPanel.IsVirtualizing="True").

Now the problem is: scrolling the tree is very unstable. I try to explain the unexplainable behaviour:

  • While scrolling, the items get just disappeared / unloaded. With WPF Inspector, I actually see, that they get continously unloaded and loaded again.
  • While scrolling through items of level3, the tree doesn't load the items which are still not loaded (as expected), but the next level2 item jumps up, on top of the visible levels 3 items.

Notes:

  • Scrolling works normal, when all Level2 Items are collapsed.
  • Turning off virtualization solves the scrolling problem (but of course I have loading problem in this case)
  • I have read here, that this bug is fixed in .Net 4.5.2. I even tried .Net 4.7.1. The behaviour remained the same.

Is there any way that I can avoid this behaviour?

Yvonnila
  • 635
  • 1
  • 5
  • 22
  • I'm not sure I understand what the symptom is. Are you saying a level 2 item is superimposed over level 3 items - drawn in the same place? – Sam Bent - MSFT Nov 28 '17 at 20:26
  • It sounds like you've discovered a bug with similar symptoms, but a different root cause, than the 4.5.2 bug you cited. Please open a bug at http://connect.microsoft.com and attach a repro (or share a repro with me). The behavior probably depends on the templates and styles for your TreeView and its items, which you haven't shown here. We recently fixed (for 4.7.2) a set of problems arising when you animate the expand/collapse of a TreeViewItem, but the symptoms were different - there was no superimposed rendering. – Sam Bent - MSFT Nov 28 '17 at 20:37

1 Answers1

0

Have you tried to set the ScrollUnit on VirtualizingPanel to Pixel-Scrolling? This helped me with a strange scolling behavior on ListViews when IsVirtualizing and IsVirtualizingWhenGrouping is set to true:

VirtualizingPanel.IsVirtualizing='True'
VirtualizingPanel.IsVirtualizingWhenGrouping='True'
VirtualizingPanel.ScrollUnit='Pixel'
Moelli.de
  • 41
  • 4
  • Yes I have tried it, but it doesn't help the problem. It is actually already set to `Pixel`. The problem is with Virtualization itself. – Yvonnila Nov 27 '17 at 13:55