Search This Blog

Wednesday, August 18, 2010

C# Clear a BitmapImage or the instance of it.

Programmer Question

I would like to clear a bitmap image. I've tried both



uploadImage.Source = null;


and



uploadImage.Source = "";


This is the code I used to make the image:



// BitmapImage.UriSource must be in a BeginInit/EndInit block
BitmapImage myBitmapImage = new BitmapImage();
string curItem = destinationFolder + "\\" + listBox1.SelectedItem.ToString();

myBitmapImage.BeginInit();
myBitmapImage.UriSource = new Uri(@curItem);
myBitmapImage.DecodePixelWidth = 200;
myBitmapImage.EndInit();
uploadImage.Source = myBitmapImage;


Find the answer here

No comments:

Post a Comment

Related Posts with Thumbnails