kstanoev
1/28/2015 - 7:40 AM

Converter that takes an object and returns an ImageBrush instance.

Converter that takes an object and returns an ImageBrush instance.

public class ImageBrushConverter : IValueConverter
{
	public object Convert(object value, Type targetType, object parameter, string language)
	{
	    return new ImageBrush { ImageSource = (BitmapImage)value, Stretch = Stretch.UniformToFill };
	}

	public object ConvertBack(object value, Type targetType, object parameter, string language)
	{
	    throw new NotImplementedException();
	}
}