您当前的位置: 首页 >  君子居易

WPF数据绑定的时候用Converter总是显示NullReferenceException: 未将对象引用设置到对象的实例

君子居易 发布时间:2022-02-24 11:39:29 ,浏览量:3

原因不明,

解决方案:添加try catch就可以

 object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string currentValue= "";
            try
            {
                
 
            }
            catch (Exception ex)
            {
                
            }
            return currentValue;
        }

关注
打赏
查看更多评论

君子居易

暂无认证

  • 3浏览

    0关注

    208博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录