views:

24

answers:

1

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?

A: 

I was able to get around this behavior by dynamically setting the MinWidth property of my panel such that it changed with the size of the container. This prevented the unnecessary calls to MeasureOverride. I'm still a bit uncertain why it was happening though.

Scott Whitlock