How can I stop <Image Source="file path"/>
process?
I want to stop this proccess because i can't use File.Delete();
Asked
Active
Viewed 280 times
0

Soner Gönül
- 97,193
- 102
- 206
- 364

user3084365
- 5
- 6
-
2Process? What process? – Soner Gönül Dec 20 '13 at 08:48
-
I think that i can't delete the file because it is opened from Image Control – user3084365 Dec 20 '13 at 08:49
-
1What??? Your question sounds like "How do I make a apple out of a banana" – RononDex Dec 20 '13 at 08:50
-
That's no separate process, but the process handle of your application... – Sebastian Edelmeier Dec 20 '13 at 08:50
-
I have a Bitmap object and object with his path.I want to delete the file from the path,although it show me a error "The file is used be another proccees" – user3084365 Dec 20 '13 at 08:53
1 Answers
1
Try this: XAML:
<Image Source="file path" x:Name="image"/>
C#:
image.Source = null;
System.IO.File.Delete(@"C:\person.gif");

Ringo
- 3,795
- 3
- 22
- 37
-
-
-
Why yes it does: http://msdn.microsoft.com/en-us/library/system.drawing.image%28v=vs.110%29.aspx – miniBill Dec 20 '13 at 09:06
-
This is an Image object in System.Drawing. In this case Image is a WPF Control. So they're difference. :D – Ringo Dec 20 '13 at 09:07
-