WPF 查看绑定错误——Snoop 的基本使用

关于

可以通过 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 '<null>' from type '<null>' 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 '<null>' (type '<null>'); 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)'
相关推荐
c#上位机8 小时前
wpf之Border
c#·wpf
SunflowerCoder8 小时前
WPF迁移avalonia之图像处理(一)
图像处理·wpf·avalonia
周杰伦fans8 小时前
WPF中的DataContext以及常见的绑定方式
wpf
没有bug.的程序员1 天前
Redis 数据结构全面解析:从底层编码到实战应用
java·数据结构·redis·wpf
somethingGoWay1 天前
wpf 自定义输入ip地址的文本框
wpf
秋月的私语1 天前
Wpf程序屏幕居中问题修复全记录
wpf
我要打打代码1 天前
WPF启动窗体的三种方式
wpf
R瑾安1 天前
mysql集群部署(Mysql Group Replication)
数据库·mysql·wpf
c#上位机1 天前
wpf中资源的使用
c#·wpf
Vae_Mars2 天前
WPF中的静态资源和动态资源
wpf