• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Using WPF, I want to know when the rendering is completed

Leros

Lifer
I'm new to WPF. I'm doing some performance testing on different methods for drawing shapes to see which method is faster. I need to measure the time from when I issue a command to when the actual pixels appear on the screen.

WPF has a UI thread and a separate hidden Render thread. There is an OnLoaded event which is triggered when the UI thread passes the drawing off to the Render thread. But I need to know when things are actually rendered. The OnLoaded event occurs a long time before the item is actually rendered.

I've got a method where I can get fairly accurate results, but it triggers a little bit before the pixels actually show up. Its good enough, but I would like to get more accurate results.

The best method would be if I could invoke a low priority item in the Render thread. That way, once all the rendering is done, that item would execute. This would occur right after the rendering is completed. Problem is, I don't think I can access the Render thread. Does anybody know otherwise?

(I have no idea if it matters, but I'm using .Net3.5 and C#).

Cliffs:
- Using WPF
- I want to access the Render thread
- Can I?
 
A couple thoughts, neither is exactly what you want but may help somewhat:

override the OnRender function
Hook onto CompositionTarget.Rendering
 
Back
Top