I have folder full of pngs. I add all the pngs to the the carousel and then after viewing those in Carousel, I need to delete those from my hard disk. But it gives me an error saying the files are still used by the carousel. How do delete the image source??
3 Answers, 1 is accepted
0
Accepted
Maya
Telerik team
answered on 24 Jul 2012, 03:53 PM
Hello Suhas,
You can clear the source of the carousel and remove the images after that.
MyCarousel.BeginInit();
foreach (string png inDirectory.GetFiles(output))
{
Image myimage = newImage();
var uri = newUri(png);
myimage.Source = newBitmapImage(uri);
myimage.Height = 200;
myimage.Width = 200;
myImages.Add(myimage);
}
MyCarousel.ItemsSource = myImages;
MyCarousel.EndInit();
To release the files used in carousel, I am doing following
MyCarousel.ItemSource = null;
MyCarousel.Items.Clear();
GC.Collect();
but still when I delete the pngs in a output folder, I get an exception saying pngs are being used by another process
which is this RadCarousel.
0
Maya
Telerik team
answered on 25 Jul 2012, 07:52 AM
Hello Suhas,
Could you take a look at this forum thread and follow the ideas illustrated in the threads mentioned there ? Do you still get the same exception ?