I have a background thread, which renders some image to WriteableBitmap.
I'm making a custom control, which will use this writeablebitmap and update every frame to make animation.
Unfortunately, now forcing this control to InvalidateVisual()
.
That worked, but the performance is pretty bad.
On the main window I subscribed to Renderer.SceneInvalidated to log some framerates.
this.Renderer.SceneInvalidated += (s, e) =>
{
_logs.Add((DateTime.Now - _prev).Ticks);
_prev = DateTime.Now;
};
And found that about 7%-10% frames are rendered in 30ms, and others 90% in 16ms. So I'm looking for a better performance solution with this problem.