WPF Custom Panels: Thou Shalt Measure Your Children

Custom panels must call Measure() on their children, even if they ignore the result. Calling just Arrange() causes weird behavior: wrap panels don’t wrap, controls get out of bounds, etc. This is probably documented somewhere, but I found it the hard way. This is a little unexpected: if I know exactly how much space I want to give the child, why should I ask it how much it wants? Well, it turns out I must still ask, or else.

Posted in

Leave a Reply

Your email address will not be published. Required fields are marked *