I have a function that is supposed to return a UIElementCollection. The function takes in a UIElement that has the children property (i.e. stackpanel, grid, etc.) but does not know which UIElement it is, so I store it into a general object.
public UIElementCollection retCol (object givenObject){
...
}
I want to return the children of the givenObject, but I can't find a way to do so besides casting givenObject as a stackpanel or grid.
Is there a way I can get the children property of the givenObject?