diff options
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT/FileImageSourcePathConverter.cs')
-rw-r--r-- | Xamarin.Forms.Platform.WinRT/FileImageSourcePathConverter.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/FileImageSourcePathConverter.cs b/Xamarin.Forms.Platform.WinRT/FileImageSourcePathConverter.cs new file mode 100644 index 00000000..64468f5e --- /dev/null +++ b/Xamarin.Forms.Platform.WinRT/FileImageSourcePathConverter.cs @@ -0,0 +1,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(); + } + } +}
\ No newline at end of file |