I have several images animated inside the Grid container, and I need to remove them from the Grid after the animation is finished to save memory.
storyboard->Completed += ref new EventHandler<Object^> ([this,birthImage,&index](Object^ sender, Object^ e) { mainGrid->Children->IndexOf (myImage, &index); mainGrid->Children->RemoveAt (index); });
Unfortunately, I cannot follow this suggestion and use mainGrid->Chilren->Remove(myImage) , because this method is available only for C # and not for C ++ / CX
Being forced to use IndexOf and then RemoveAt causes concurrency problems.
I need a solution to remove an object from a view hierarchy in C ++ / CX
Something that in the iOS world can be done with a single: [object removeFromSuperView];
source share