-
Hello all, I'm having an issue with an application ported from WPF, where the application freezes while a complicated UI element is being constructed. The UI element is essentially one big In WPF, this worked well enough, as it allows you to construct UI elements on a different thread as long as they're not active, but now in Avalonia I can't construct
The issue is that the engine backing up this layout is doing quite a lot of work while building the UI elements - as it's quite an involved layout system. In theory I could build an intermediate representation of the geometry, but this seems like it's just going to shorten the freezing problem rather than really get around it, as this representation will still have to be converted into Avalonia elements at some point. Now, I know Avalonia is constrained to be mono-threaded for the UI due to hardware restrictions for some devices, so I get why I can't build high level UI components on another thread. But why can't I build I wondered about a custom rendering pass of some kind, but the UI would still pause while it was doing this, right? Can I use this "render to an off-screen location" trick I've been hearing about from a different thread? But then I'm rendering to a bitmap, right, and will need to deal with resolution issues (as this canvas needs to be zoomable)? Or is the solution to build an intermediate representation and just try and make the conversion from representation to Your suggestions and wisdom are much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
You may need to use |
Beta Was this translation helpful? Give feedback.
-
You are right, that some simpler primitives like geometry is possible to be built on secondary threads in theory. It wasn't implemented in supported in Avalonia yet, as we weren't prioritizing it. If you need to build really large primitives and render it on secondary threads, you might need to skip whole PathGeometry layer. |
Beta Was this translation helpful? Give feedback.
You are right, that some simpler primitives like geometry is possible to be built on secondary threads in theory. It wasn't implemented in supported in Avalonia yet, as we weren't prioritizing it.
It might not be too difficult to implement at this point.
If you need to build really large primitives and render…