There is a heavy UI inside the window, while it is rendered, the entire window hangs, as it is possible to render the UI asynchronously, without blocking the entire UI window. My thoughts lead me to asynchrony. Render is heavy because there is a recalculation of already rendered elements, кол-во элементов = ширина окна / среднее арифметическое ширины всех уже зарендеренных .

  • 2
    It is unlikely to turn out so straight. All operations with UI objects must be in a UI stream. Are you sure that the problem is in the rendering? Maybe it makes sense to separate the content from the presentation even more and calculate all the heavy math in the background? - VladD
  • @VladD now I am starting to “pump over” the code, remove all unnecessary and think over logic, I understand that most likely asynchrony may not even be needed, I found a lot of excess code and did not enter the buffer operation, but I had to. - ParanoidPanda

1 answer 1

Create manually in asynchronous flow through the Dispatcher and insert it into the window. Although it is worth noting that this is not a pure asynchronous stream, but it can solve the problem of simultaneous operation in the application.

 Dispatcher.InvokeAsync(() => { Button button = new Button(); button.Content = "Click Me"; sPanel.Children.Add(button); });