PowerToys/Wox.Infrastructure/Image/ImagePathConverter.cs

25 lines
682 B
C#
Raw Normal View History

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