Hello, i'm developing a contacts manager that allows the user to choose a picture for the contacts, so i have a listbox, and custom listbox items, which contains a Datatemplate containing the image of the contact, so when i have more than 5 contacts my app gets kind of slow while loading the contacts, i have made several tests on how to load images quicker, but without good results.

This is the code i use to load images from a string value which is the path of the image.

C# Code:
  1. FileStream Strm = new FileStream((string)value, FileMode.OpenOrCreate);                  
  2.  
  3.  BitmapImage Image = new BitmapImage();
  4. Image.BeginInit();
  5. Image.CacheOption = BitmapCacheOption.OnLoad;
  6. Image.StreamSource = Strm;
  7. Image.EndInit();
  8.  
  9. Image.Freeze();
  10. Strm.Dispose();
  11. Strm.Close();
  12.  
  13. return Image;

If someone can improve this code, or let me know about some other way to load images faster i would appreciate it.

Thanks a lot