How to measure screen render time in WPF

I am attempting to measure the performance for a WPF based application. Currently we have code that times how long it takes to add the content to the WPF render tree. At this point, control is returned to our program. The problem is that there is still a lag before content is displayed on the screen by WPF. For complicated rendering trees, this can be a matter of seconds.

Can you recommend a method to determine when WPF has completed rendering to the screen? I would like these tests to be fully automated and not rely on someone sitting around with a stopwatch.

[update]

Thanks for the suggestions so far.

I have tried waiting for the Loaded and ContentRendered events, but both fire before the content makes it to the screen.

It looks like others are having this issue. I have tried the steps suggested at http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/693fbedb-efa6-413e-ab66-530c6961d3fb/ , но все еще не смог заставить мой код ждать для завершения рендеринга.

15
задан Brian Erickson 1 April 2011 в 00:21
поделиться