summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT/FileImageSourcePathConverter.cs
blob: 64468f5ed420f486b9eef79ecc7195b9cb1a879d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
using Windows.UI.Xaml.Controls;

#if WINDOWS_UWP

namespace Xamarin.Forms.Platform.UWP
#else

namespace Xamarin.Forms.Platform.WinRT
#endif
{
	internal class FileImageSourcePathConverter : Windows.UI.Xaml.Data.IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, string language)
		{
			var source = (FileImageSource)value;
			string uri = "ms-appx:///" + (source != null ? source.File : string.Empty);
			return new BitmapIcon { UriSource = new Uri(uri) };
		}

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