For disposing object we can call the Dispose method or wrap the object with a using
block.
In your case, you create BitmapImage
, Image
, TextBlock
and StackPanel
. None of these classes implement IDisposable. So, you don't need to dispose the objects, just remove them from the list (and then no one will have a reference to them), and the GC will free them.