我正在将Image的Source属性绑定到一个字符串。如果该字符串为空,我只是不想显示图像。但是,在我的调试输出中,我得到了以下内容:
System.Windows.Data Error: 23 : 无法将“<null>”从类型“<null>”转换为“System.Windows.Media.ImageSource”的类型,对于默认转换和“en-AU”区域性考虑使用Binding的Converter属性。NotSupportedException: 'System.NotSupportedException: ImageSourceConverter无法从(null)进行转换。 at System.ComponentModel.TypeConverter.GetConvertFromException(Object value) at System.Windows.Media.ImageSourceConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'。
我希望这不会被显示出来,因为它只是噪音 - 有没有办法抑制它?