WPF layout calls MeasureOverride repeatedly in increments of 2?

Posted by Scott Whitlock on Stack Overflow See other posts from Stack Overflow or by Scott Whitlock
Published on 2010-06-14T02:00:16Z Indexed on 2010/06/14 2:02 UTC
Read the original article Hit count: 208

Filed under:
|
|

I've run into a case where I have a custom Panel (inherits from Panel) and I'm using it as an ItemsPanel in a ListView.

When I resize the container that it's in, if I resize it smaller, my panel's MeasureOverride function gets called once, but if I resize it larger (let's say from 100 to 300), it calls MeasureOverride and ArrangeOverride for every value between 100 and 300, in increments of 2 (so 102, 104, etc.).

The weird thing is that the container resizes right away (its size gets to 300 immediately).

It doesn't seem to matter what I return from MeasureOverride - it just does this.

I wish I could make it happen in a really small application and post it here, but I haven't been able to reproduce it like that yet. I can reproduce it all day in my app though.

Does anyone know what could cause this?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about layout