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/Converters/ImagePathConverter.cs

29 lines
849 B
C#
Raw Normal View History

2025-03-19 10:04:16 +08:00
using System;
//using System.Collections.Generic;
2025-03-19 10:04:16 +08:00
using System.Globalization;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
2025-03-19 10:04:16 +08:00
using System.Windows.Data;
using System.Windows.Media.Imaging;
2025-03-24 13:49:48 +08:00
namespace Karaoke_Kingpin.Converters
2025-03-19 10:04:16 +08:00
{
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();
}
}
}