This repository has been archived on 2022-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
DevOpsOpenHack/MobileApps/MyDriving/MyDriving.UWP/Converters/ImageSourceConverter.cs
2022-11-03 16:41:13 -04:00

33 lines
950 B
C#

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
using System;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media.Imaging;
namespace MyDriving.UWP.Converters
{
public class ImageSourceConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
string url = value as string;
if (!string.IsNullOrWhiteSpace(url))
{
try
{
return new BitmapImage(new Uri(url));
}
catch (Exception)
{
}
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}