You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1009 B
35 lines
1009 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.IO;
|
|
using System.Text;
|
|
using System.Windows.Data;
|
|
|
|
namespace vues.converters
|
|
{
|
|
class StringToImageConverter : IValueConverter
|
|
{
|
|
private static string imagesPath;
|
|
|
|
public StringToImageConverter()
|
|
{
|
|
imagesPath = Path.Combine(Directory.GetCurrentDirectory(), "images_logo\\");
|
|
}
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
string imageName = value as string;
|
|
|
|
if (string.IsNullOrWhiteSpace(imageName)) return null;
|
|
|
|
string imagePath = Path.Combine(imagesPath, imageName);
|
|
|
|
return new Uri(imagePath, UriKind.RelativeOrAbsolute);
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|