Revision 31cdee54

b/trunk/Pithos.Client.WPF/Converters/ImageNameToImageConverter.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Globalization;
4
using System.Linq;
5
using System.Text;
6
using System.Windows.Data;
7
using System.Windows.Media.Imaging;
8

  
9
namespace Pithos.Client.WPF.Converters
10
{
11
    public class ImageNameToImageConverter: IValueConverter
12
	{
13
	    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
14
	    {
15
	        var image = new BitmapImage();
16
            image.BeginInit();
17
            image.UriSource = new Uri(String.Format("pack://application:,,,/PithosPlus;component/Images/{0}", value));
18
            image.EndInit();           
19
	        return image;
20
	    }
21

  
22
	    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
23
	    {
24
	        throw new NotImplementedException();
25
	    }
26
	}
27
}

Also available in: Unified diff