山西省建设监理协会网-官方网站,网站添加备案号,文创网站,网页设计团队问题#xff1a;wpf中#xff0c;Button IsEnabled{Binding IsValid1}/Button#xff0c;如果没定义绑定的属性IsValid1#xff0c;可以正常用吗
解答#xff1a;在 WPF 中#xff0c;如果没有定义绑定的属性 IsValid1#xff0c;会导致绑…问题wpf中Button IsEnabled{Binding IsValid1}/Button如果没定义绑定的属性IsValid1可以正常用吗
解答在 WPF 中如果没有定义绑定的属性 IsValid1会导致绑定失败从而使 Button 的 IsEnabled 属性无法正常绑定。在这种情况下Button 的 IsEnabled 属性将保持默认值即为 true。 另外错误信息会在vs运行时在输入中体现
System.Windows.Data Error: 12 : TargetNullValue 属性不存在 (type String) cannot be converted for use in IsEnabled (type Boolean). BindingExpression:PathIsValid1; DataItemnull; target element is Button (Name); target property is IsEnabled (type Boolean) FormatException:System.FormatException: 属性不存在 不是 Boolean 的有效值。 --- System.FormatException: 该字符串未被识别为有效的布尔值。在 System.Boolean.Parse(String value)在 System.ComponentModel.BooleanConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)--- 内部异常堆栈跟踪的结尾 ---在 System.ComponentModel.BooleanConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)在 System.Windows.Data.BindingExpressionBase.ConvertValue(Object value, DependencyProperty dp, Exception e)