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)'

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值