public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is not String imagePath || targetType != typeof(ImageSource)) { return(DependencyProperty.UnsetValue); } return(BitmapImageLoader.LoadImageFromFile(imagePath)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is not DiscImageSource imageSource || targetType != typeof(ImageSource)) { return(DependencyProperty.UnsetValue); } if (imageSource.IsImageForDeletedDisc) { return(new BitmapImage(new Uri("pack://application:,,,/PandaPlayer;component/Views/Icons/Deleted.png", UriKind.Absolute))); } if (imageSource.IsMissingImage) { return(new BitmapImage(new Uri("pack://application:,,,/PandaPlayer;component/Views/Icons/Image-Not-Found.png", UriKind.Absolute))); } return(BitmapImageLoader.LoadImageFromFile(imageSource.FilePath)); }