Michael T
Michael T

Reputation: 1367

How do you debug "value produced by BindingExpression is not valid for target property" errors?

I'm getting the following in the program output when I run my application. When I search my application I can not find any time named "btnOpen."

I know these binding errors is because some bound-property is returning null to the tooltip.name. But, is this in my program, a referenced library, or something else? How do I track these down? I don't know and can't find btnOpen or btnPrint. My print buttons don't even use tooltips.

System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' BindingExpression:Path=ToolTip; DataItem='Button' (Name='btnOpen'); target element is 'Button' (Name='btnOpen'); target property is 'Name' (type 'String')

System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' BindingExpression:Path=ToolTip; DataItem='Button' (Name='btnPrint'); target element is 'Button' (Name='btnPrint'); target property is 'Name' (type 'String')

Upvotes: 1

Views: 3265

Answers (2)

Robert S.
Robert S.

Reputation: 25294

If you don't use Hungarian notation when naming your controls, that might be the first clue that btnOpen is not part of your project. Are you using any third-party controls? If so, open up the libraries in Reflector and see if you can find any references to btnOpen. That's where I would go.

Upvotes: 1

CodeNaked
CodeNaked

Reputation: 41393

The elements are named, so search your solution for btnOpen and btnPrint, as those are the elements with the bindings.

Upvotes: 0

Related Questions