public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null) { return(null); } Project project = (Project)value; string kind = project.Kind; ImageSource imageSource; if (!_imageCache.TryGetValue(kind, out imageSource)) { imageSource = ProjectUtilities.GetImage(project); _imageCache.Add(kind, imageSource); } return(imageSource); }