| 123456789101112131415161718192021222324 |
- using System;
- using System.Globalization;
- using System.Windows.Data;
- using System.Windows.Media.Imaging;
- namespace SWRIS.Converters
- {
- public class StringToImageSourceConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is string path)
- {
- return new BitmapImage(new Uri($"pack://application:,,,/{path}"));
- }
- return null;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|