Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine what caused LayoutUpdate/ArrangeOverride to occur?

Tags:

wpf

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?

like image 992
Ryan Cromwell Avatar asked Mar 26 '09 15:03

Ryan Cromwell


2 Answers

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.

like image 148
Pavel Avatar answered Sep 30 '22 16:09

Pavel


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.

like image 24
archimed7592 Avatar answered Sep 30 '22 15:09

archimed7592