This repository has been archived on 2025-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
Karaoke-Kingpin/ImagePathConverter.cs
2025-03-19 10:04:16 +08:00

29 lines
830 B
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media.Imaging;
namespace Karaoke_Kingpin
{
public class ImagePathConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return null;
string imagePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, value.ToString());
return new BitmapImage(new Uri(imagePath));
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}