WPF在WindowsXP上加载图像的性能不佳

WPF在WindowsXP上加载图像的性能不佳,wpf,performance,bitmapimage,Wpf,Performance,Bitmapimage,我有一些代码来加载图像拇指并在列表框中显示它们。它在Win7上正常工作。在WindowsXP上,我需要大约7到10分钟来加载一些大图像,而在7上则需要几秒钟。我怎样才能加快速度 public static string AddImage(string file) { string key = "IMG_" + (++_counter).ToString("00000"); ImageInfo inf = new ImageInfo();

我有一些代码来加载图像拇指并在列表框中显示它们。它在Win7上正常工作。在WindowsXP上,我需要大约7到10分钟来加载一些大图像,而在7上则需要几秒钟。我怎样才能加快速度

    public static string AddImage(string file)
    {
        string key = "IMG_" + (++_counter).ToString("00000");
        ImageInfo inf = new ImageInfo();
        inf.OriginalPath = file;
        inf.ID = key;
        inf.OriginalPath = file;

        BitmapImage bi = new BitmapImage();
        bi.BeginInit();
        bi.DecodePixelWidth = THUMB_SIZE;
        bi.CacheOption = BitmapCacheOption.OnLoad;
        bi.UriSource = new Uri(file);
        bi.EndInit();
        inf.ThumbBitmap = bi;

        _storedImageInfo.Add(key, inf);

        return key;
    }

ImageInfo是我自己的类,包含对位图图像和图像路径的引用。我不认为它对加载时间有重大影响。

如果不设置
DecodePixelWidth
属性,它的行为如何?例如,你是对的,DecodePixeWidth就是原因。现在我正在使用这里描述的方法--而且它要快得多。