Friday, September 21, 2012

LayoutUpdated event needs to update the layout...infinite loop

LayoutUpdated event needs to update the layout...infinite loop

I am using C#, Silverlight, WP7.

I am trying to add an overlay to my app (similar to this) that overlays at the end of each series of LayoutUpdated events.

The first problem is that LayoutUpdated gets fired multiple times on each control event, whether it's just loading the app or scrolling or pivoting. I need to execute my code after the last LayoutUpdated event. According to this question, doing a BeginInvoke on the Loaded event will allow my code to wait for all events to finish firing. Is my understanding of this correct?

The other problem is updating the layout...on a LayoutUpdated event. This question says there will be an infinite loop of LayoutUpdated events firing, and that the solution is to set a hasChanged flag. But the flag needs to be reset by something so that on the next control event, right?

I'm confused how to implement a solution that solves both of these questions.
Thanks in advance.

Answers & Comments...




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog