using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace CtrEditor.Converters { public class ImageDisplayNameConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is string imageName) { // Buscar el MainViewModel en el Application.Current.MainWindow.DataContext if (Application.Current?.MainWindow?.DataContext is MainViewModel viewModel) { return viewModel.GetImageDisplayName(imageName); } } return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }