The right way to do this in a WPF application is to use the MVVM pattern and to remove all logic and dependencies from your Views (controls) and into ViewModels.
Your parent ViewModel would create a child ViewModel that implemented IDisposable
and then when it removed the child ViewModel it would call Dispose
on the child ViewModel.
If your main ViewModel has unmanaged resources that need to be cleaned up, then it should implementIDisposable
and the bootstrapper that creates that should take responsibility for cleaning them up.
Another good reference is Caliburn.Micro