According to MSDN - Panel.InternalChildren Property:
Classes that are derived from Panel should use this property, instead of the Children property, for internal overrides such as MeasureCore and ArrangeCore.
So, this is really a 2 part question:
If I create a Panel of my own, FooPanel
, which derives from Panel
, I can't seem to override MeasureCore
or ArrangeCore
. I'm not sure why that statement is even there. I can, however, override MeasureOverride
and ArrangeOverride
. So, I wonder if I still need to use the InternalChildren
property for these 2 methods.
What is the real difference between the Children
property and the InternalChildren
property?
You would override MeasureOverride and ArrangeOverride, that must be a mistake in the documentation, or intended for internal Microsoft employees. The MeasureCore and ArrangeCore are sealed by FrameworkElement, so you can't override them.
The Children property is public and simply calls InternalChildren, which is protected. So either is probably safe, since Children would get inlined.
MSDN says otherwise ( http://msdn.microsoft.com/en-us/library/ms754152.aspx) but the documentation is wrong. (use reflector to see that the implementation of Children simply calls InternalChildren)