I created a custom Panel
, within which I need to check whether its Children
are managed by manipulating the collection manually, or whether the panel is used as ItemsPanel
for an ItemsControl
.
This to prevent the following exception from being thrown when trying to manipulate Children
.
Cannot explicitly modify Children collection of Panel used as ItemsPanel for ItemsControl. ItemsControl generates child elements for Panel.
How can I differentiate between the two different usages of the panel?