Pavel Brožek
Pavel Brožek

Reputation: 1

Real effect of return value in ArrangeOverride method

I am trying to implement custom panel in WPF and I don't understand what the real effect of return value from ArrangeOverride method is. It seems that it is allways ok to return finalSize (the argument of ArrangeOverride) without changing it.

Is there a situation in which I should return something different than finalSize?

Upvotes: 0

Views: 185

Answers (1)

Clemens
Clemens

Reputation: 128061

As stated in the online documentation, ArrangeOverride returns

The actual size used.

So if (for whatever reason) the actual size required by a Panel's children differs from finalSize in one or the other dimension, the method may return a different size.

It is however safe to always return finalSize. This would just mean that your Panel has already determined its final size during the measure pass, and did not adjust it during the actual arrangement of its children.

Upvotes: 0

Related Questions