2014-02-19 22:50:15 +08:00
|
|
|
using System;
|
|
|
|
using System.Globalization;
|
2014-07-16 18:52:00 +08:00
|
|
|
using System.Windows;
|
2014-02-19 22:50:15 +08:00
|
|
|
using System.Windows.Data;
|
|
|
|
|
2016-05-04 04:18:26 +08:00
|
|
|
namespace Wox.Infrastructure.Image
|
2014-02-19 22:50:15 +08:00
|
|
|
{
|
2014-07-16 18:52:00 +08:00
|
|
|
public class ImagePathConverter : IValueConverter
|
2014-02-19 22:50:15 +08:00
|
|
|
{
|
2014-07-16 18:52:00 +08:00
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
2014-02-19 22:50:15 +08:00
|
|
|
{
|
2014-07-16 20:17:51 +08:00
|
|
|
if (value == null || value == DependencyProperty.UnsetValue)
|
2014-02-28 23:21:01 +08:00
|
|
|
{
|
2014-07-16 20:17:51 +08:00
|
|
|
return null;
|
2014-02-28 23:21:01 +08:00
|
|
|
}
|
2016-04-26 09:40:23 +08:00
|
|
|
var image = ImageLoader.Load(value.ToString());
|
2016-04-23 05:42:26 +08:00
|
|
|
return image;
|
2014-02-19 22:50:15 +08:00
|
|
|
}
|
|
|
|
|
2014-07-16 18:52:00 +08:00
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
2014-02-19 22:50:15 +08:00
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|