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;
|
|
|
|
|
2014-05-24 16:06:09 +08:00
|
|
|
namespace Wox.Converters
|
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-23 05:42:26 +08:00
|
|
|
var image = App.ImageLoader.Load(value.ToString());
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|