Error binding WPF binding to hit versus exception

when we bind to a heterogeneous set 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: The property "RoundingFactor" could not be found 'object' '' MultiLineTextMarkingScheme '(HashCode = 7262386). BindingExpression: Path = RoundingFactor; ..........

This does not seem like an exception, but we are concerned that it affects performance.

Should we be interested and create a view model that has all the properties that we want to bind (and have properties that do not exist in the base element, returns null) or can we just leave it.

This situation is often encountered in a grid scenario where there may be a large number of these binding failures.

+7
performance exception data-binding wpf
source share
2 answers

You see this conclusion only because you are working in Visual Studio. Typically, these trace instructions do not exist anywhere because there is no trace listener. In any case, the performance implications are completely negligible.

Exceptions, on the other hand, would be a very expensive way to report binding errors, especially because, as you have noticed, bindings often occur that work with some objects, but not with others.

+6
source share

I have not tested this myself, but a blog post from the Visual Studio team says that binding errors do affect performance:

WPF tries several ways to troubleshoot path errors, including finding attached properties, and it's quite expensive.

+14
source share

All Articles