Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Image Source in silverlight for WP7

Is it possible to programatically remove the source of an Image file? Or is it better to just set the source to a new bitmap that is undefined?

The current way I'm doing it is:

BitmapImage bmpClear = new BitmapImage();
                CanvasImg.Source = bmpClear;

I never set the source of bmpClear, so the previous image that was set to CanvasImg is removed with nothing to replace it. Is this a good solution or will this cause unintended consequences?

like image 391
BigPete Avatar asked Nov 30 '25 17:11

BigPete


1 Answers

You should be able to just set it to null and clear it out

CanvasImg.Source = null;

But your solution should work just fine as well.

like image 69
Steve Danner Avatar answered Dec 03 '25 09:12

Steve Danner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!