关于
可以通过 Snoop 查看 WPF 程序的 Visual Tree,更多介绍请看 snoopwpf
快速开始
一、下载 snoopwpf.msi
安装后打开,选择自己的程序,点击 snoop(望远镜)
二、筛选
点击左侧下拉列表,选择 Show only elements with binding errors
三、点击出错的节点,右侧点击 Properties,然后滚动表格,找到标红的一行
四、右键选择 Display Binding Errors
五、分析错误
System.Windows.Data Error: 23 : Cannot convert '' from type '' to type 'System.Double' for 'en-US' culture with default conversions; consider using Converter property of Binding. NotSupportedException:'System.NotSupportedException: DoubleConverter 无法从 (null) 转换。 在 System.ComponentModel.TypeConverter.GetConvertFromException(Object value) 在 System.ComponentModel.TypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) 在 System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) 在 MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'System.Windows.Data Error: 6 : 'ObjectSourceConverter' converter failed to convert value '' (type ''); fallback value will be used, if available. BindingExpression:Path=Tag; DataItem='ProgressBar' (Name=''); target element is 'Rectangle' (Name=''); target property is 'RadiusX' (type 'Double') NotSupportedException:'System.NotSupportedException: DoubleConverter 无法从 (null) 转换。 在 MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward) 在 MS.Internal.Data.ObjectSourceConverter.Convert(Object o, Type type, Object parameter, CultureInfo culture) 在 System.Windows.Data.BindingExpression.ConvertHelper(IValueConverter converter, Object value, Type targetType, Object parameter, CultureInfo culture)'
来源地址:https://blog.csdn.net/chaoge_dgqb/article/details/132460239