using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; namespace MV485.helper { public class ImageExistenceToRowHeightConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { // 判断图片路径是否为空或空字符串 string imagePath = value as string; if (string.IsNullOrEmpty(imagePath)) { // 图片不存在,返回行高30 return 100; } else { // 图片存在,返回行高60 return 200; } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { // 不需要实现ConvertBack throw new NotImplementedException(); } } }