views:

58

answers:

1

when we bind to heterogeneous collection of objects, not all objects have the same set of properties. in the output window we get a message like:

System.Windows.Data Error: 39 : BindingExpression path error: 'RoundingFactor' property not found on 'object' ''MultiLineTextMarkingScheme' (HashCode=7262386)'. BindingExpression:Path=RoundingFactor;..........

This doesn't appear to be an exception, but we are concerned it has a performance impact.

Should we be concerned and create a view model that has all the properties we wish to bind to (and have the properties that dont exist on the underlying element return null) or can we just leave it.

This situation often occurs in a grid scenario where there might be large numbers of these binding failures.

+1  A: 

You're only seeing that output because you're running inside Visual Studio. Normally those trace statements go nowhere because there is no trace listener. Either way, the performance implications are completely negligible.

Exceptions, on the other hand, would be a very costly way of reporting binding failures, particularly because - as you note - there are often bindings that work against some objects but not others.

HTH,
Kent

Kent Boogaart