Is there a way to detect Layout or Display changes in WPF?

Posted on Stack Overflow See other posts from Stack Overflow
Published on 2009-01-28T10:36:05Z Indexed on 2010/06/06 6:02 UTC
Read the original article Hit count: 297

Filed under:
|
|

Hello!

I am trying to check how fast the Frame control can display a FixedPage object when it is assigned to Frame.Content property. I plan to check the tick count before and after the assignment to the Content property.

Example:

int starttime = Environment.TickCount;
frame1.Content = fixedpage;
int endtime = Environment.TickCount;

The problem is that the assignment to the Content property might be asynchronous and returns immediately therefore i get a zero amount of time. The rendering of the FixedPage however visually has a lag time from assignment of the Content property up to the point where the FixedPage appears on screen.

The Frame.ContentChanged() event is no good either because it gets triggered even before the FixedPage appears on screen so it's not accurate.

I'm thinking of detecting the change on the window or control's display instead in order to get the time when the FixedPage is actually displayed on screen.

Is there a way to do this in WPF?

Thanks!

© Stack Overflow or respective owner

Related posts about wpf

Related posts about display