5

I have a custom Panel which upon resizing has its LayoutUpdated event and ArrangeOverride called twice.

So initially MeasureOverride and ArrangeOverride do their thing once upon open of the client window. Then, if I maximize the window each are called twice. The Available and Final Sizes respectively are not different between each iteration so I'm not sure what's initiating this.

Is there a way to determine the cause of the Invalidation?

Ryan Cromwell
  • 2,613
  • 1
  • 17
  • 33
  • I'm experiencing an issue that has be asking a similar question: http://stackoverflow.com/questions/1577240/wpf-layoutupdated-event-firing-repeatedly – Drew Noakes Oct 16 '09 at 10:12

3 Answers3

6

I think that it is called twice because the Height and Width changes. I think that both of those properties affect Measure and thus there is a layout pass for each one.

Pavel
  • 652
  • 7
  • 12
3

Is there a way to determine the cause of the Invalidation?

Invalidation usually is caused by a change of a DependencyProperty which among it's FrameworkPropertyMetadataOptions has flags AffectsMeasure/AffectsOverride.

As Pavel already said - it's likely that invalidation fires for both changes in Width and Height.

Anyway, you shouldn't rely on the number of those invalidations.

HolisticElastic
  • 937
  • 8
  • 17
0

I would say the easiest way is setting a breakpoint for each method and observing the call stack. You will be able to see what happened before your method was called.

Denis Vuyka
  • 2,805
  • 1
  • 17
  • 10