Replies: 1 comment 1 reply
-
This might be a bug but all I can advise is to never use data binding on complex/large data. Not in windows or Apple. It is known to be very slow. And don’t start to go declarative with SwiftUI or jetpack compose in this cases. It becomes insane slow for little benefits. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a large set of hierarchical data, too much to display at once, so I allow the user to page thru it. I have been working on UI perf and have hit a snag with ListView.
Currently the data is bound to an observable collection of a Class which also implements INotifyPropertyChanged to allow updates of some data in the class to update the control UI. The user can page thru the large collection of data. Next/Prev buttons get new results that re-populate the ListView by updating the viewable collection. It all works well., except for UI flickering in TreeView.
Worth mentioning, the data set can also be viewed in other ways, so the tree view can be replaced with a ListView that binds to the same collection in the same way. I mention this because I am not having the same issues in the ListView control on the same data set and binding model.
So the problem: When updating the TreeView with new data, I am getting odd update behaviors. The tree is first rendered with some nodes in the unexpanded state (they are set to IsExpanded, verified). It's just for a few frames, then you can see the chevrons change and the data get drawn. It's ugly and unprofessional looking. It looks like a simple flickering update bug at first, but in reality (recorded and stepped thru the frames) it's doing multiple UI updates that don't reflect the state of the nodes.
As a test, I turned off the databinding and just manually populated the tree with basic string data, and the problem goes away. It's fast, and snappy and no flickering.
At first I thought it was some sort of transition animation happening, but I have those set to x:Null, and they have no effect on or off in the un-bound test case.
Is this just a bug in TreeView? Is Data Binding perf so slow the render UI is getting ahead of the binding process and causing these intermediate states to get rendered while it's populating the tree? I don't think it is data binding or render perf, because the ListView version bound to the same data set uses more bindings and a more complex Grid for the DataTemplate than the TreeView and it performs fine, as I stated earlier.
I would just manually build the TreeView without databinding as I did in the test, but it seems they went out of their way to make it difficult, possibly impossible, to use more than a string for TreeViewNode.Content and have it display. Another thing ListView does fine, but doesn't work in ListView. So frustrating.
I've searched and can't find a mention of this specifically. Maybe I'm missing something. Suggestions welcome.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions