public void RemoveChild(UIElement element)
{
// Check the element is in the collection
if (_stateDict.ContainsKey(element))
{
// If the element is not already marked to be removed...
MetaElementState elementState = _stateDict[element];
if (elementState.Status != MetaElementStatus.Removing)
{
// Mark element to be removed
elementState.Status = MetaElementStatus.Removing;
elementState.TargetChanged = true;
// Need to measure to force remove animation
InvalidateMeasure();
}
}
}