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)'
相关推荐
苏克贝塔几秒前
WPF13-MVVM进阶
wpf
吾与谁归in3 小时前
C#实现本地Deepseek模型及其他模型的对话
人工智能·c#·wpf·deepseek
lisenustc1 天前
WPF学习之Prism(二)
学习·wpf
百里与司空3 天前
WPF基本布局基础
学习·wpf
qq_382391333 天前
WPF框架学习
学习·wpf·1024程序员节
CE贝多芬4 天前
WPF的页面设计和实用功能实现
c#·wpf
酷炫码神4 天前
WPF布局控件
wpf
code_shenbing4 天前
WPF 实现虚拟键盘
c#·wpf
code_shenbing5 天前
WPF实现打印机控制及打印
wpf
界面开发小八哥5 天前
界面组件DevExpress WPF中文教程:Grid - 如何显示和隐藏列?
wpf·界面控件·devexpress·ui开发·.net9