Hi,
I am trying to write my custom collection of UIElements inside my custom Panel that shall only add or remove UIElements without any additional logic like probably the standard microsoft InternalChildren collection might contain.
The custom collection shall kind of work like I mentioned already as standard microsoft InternalChildren. As I already mentioned I am writing a custom Panel and I would like to understand what is going on under the hood of such panels in Wpf therefore I am doing this.
I realized that just overriding methods like GetChildrenCount or GetVisualChild doesnt do the job since for some reason children collection behaves bit strange once inside Panels. What I mean by strange is that once I try to do add action on my custom collection of type List<UIElement> while inside MeasureOverride of the panel I get exceptions thought when I use the standard InternalChildren everything works fine. I assume that microsoft does some additional internal logic.
I need to have my custom UIElementCollection just to manage the items without any additional logic.
Am I missing something except overriding GetChildrenCount and GetVisualChil(index) methods?
I appreciate any ideas, suggestions, code example etc.