Binding Errors in WPF / XAML


WPF doesn’t raise exceptions to notify programmer about data binding problems. If you specify an element or a property that doesn’t exist, you won’t receive any indication; instead, the data will simply fail to appear
in the target property. At first glance, this seems like a debugging nightmare. Fortunately, WPF does output trace information that details binding failures. This information appears in Visual Studio’s Output window
when you’re debugging the application. For example, if you try to bind to a nonexistent property, you’ll
see a message like this in the Output window:



System.Windows.Data Error: [ERROR_NO] : BindingExpression path error: 
[BINDING_PROPERTYNAME] property not found on 'object' ''[Control]' (Name='[Control Name]')'. 
BindingExpression:Path=[BINDING_PROPERTYNAME]; DataItem='[Control]' (Name='[Control Name]'); 
target element is '[Control]' (Name=''); 
target property is '[Property]' (type '[VALUE_DATA_TYPE]') 

No comments:

Post a Comment