Replies: 3 comments 9 replies
-
What platform is this? On desktop, 60 bindings in a "normal" app should not have a serious effect on performance to that degree unless they're generating controls or the converters are doing serious work. |
Beta Was this translation helpful? Give feedback.
-
If bindings specifically are the bottleneck in your program, please check 11.1 builds. Bindings subsystem was partially reworked there, and it might make a difference for your app. Also make sure you use only CompiledBindings (can be enabled globally, see docs).
Have you checked that with profiler like dotTrace? It might show where exactly its freezing. |
Beta Was this translation helpful? Give feedback.
-
I did some tests and found out that the reason why my UI freezes is because there are too many controls. For an application like mine, VirtualizingStackPanel is more suitable. But since I need to dynamically control whether the controls are displayed, this conflicts with the existing design of VirtualizingStackPanel. I looked for it and found that a contributor from Avalonia submitted a commit about controlling the item IsVisible in VirtualizingStackPanel, but it seems that it was rolled back in the end because of too many bugs or other reasons. So it seems that I can't solve this problem in a short time, and I can only wait for the new commit of controlling the item IsVisible in VirtualizingStackPanel to be released. |
Beta Was this translation helpful? Give feedback.
-
I have a project (it's a company project, so I cannot provide its source code), in which a usercontrol has about 60 bindings (most of them with converter). These binding functions and styles are irregular, so they cannot be presented in a templated way using listbox or the like.
At the same time, due to the logic of the software function, I cannot split it into several different pages for display in a pagination-like manner.
The problem I'm having now is that every time I load this usercontrol, the UI freezes for about 3 seconds. The strange thing is that this only happens when the program first loads the usercontrol, and not when you close the usercontrol and then reopen it.
After checking other reasons, I found the cause of the problem was binding. I tried to clear all bindings, and the program UI no longer froze.
The usercontrol was originally bound to a series of static variables, but I later discovered that binding static variables was also a factor affecting its performance. After I changed it to no longer bind static variables but to bind regular variables, the UI still freezes, but the duration of the freeze is reduced to about 1 second. PS: A considerable number of these bindings are two-way bindings.
But what I want to achieve is to completely solve the UI freeze situation. Is there any way to solve the performance problem of a large number of bindings in the same usercontrol?
PS:What I'm actually doing is a settings page similar to the one below:
Beta Was this translation helpful? Give feedback.
All reactions