0

When I run my WPF application, I get lots of binding expression errors showing in Output window. But each error message does not tell me which view (.xaml) file has the error. For example, the error below does not tell me:

System.Windows.Data Error: 40 : System.Windows.Data Error: 40 :
BindingExpression path error: 'IsVisible' property not found on 'object' 
''PrescriptionViewModel' (HashCode=9677327)'. BindingExpression:Path=IsVisible; 
DataItem='PrescriptionViewModel' (HashCode=9677327); target element is 
'ViewPortContentPanel' (Name=''); target property is 'Visibility'
(type 'Visibility')

Is there a way to figure this out. My element ViewPortContentPanel is used in dozens of views in my application, herein lies the problem of finding it.

Thanks!

Rohit Vats
  • 79,502
  • 12
  • 161
  • 185
Ray
  • 4,679
  • 10
  • 46
  • 92
  • How many views do you have? Look in your XAML and see where you are trying to modify those propreties. – gleng Apr 10 '14 at 19:34
  • Usually, you have one View Model object per window. Are you using only one View Model object in all screens? – Tony Vitabile Apr 10 '14 at 20:12
  • This is a Prism application with close to a hundred views and the view's datacontext is not evident in this type of app. The view model mentioned in the error is a composite view model that supplies the properties to multiple sub-views. – Ray Apr 11 '14 at 01:21
  • Try debugging the application by enabling the `Common Language Runtime Exceptions`. The option is under `Debug > Exceptions`. – Sandesh Apr 11 '14 at 03:19

1 Answers1

0

If You properly specified all of your bindings and DataContext You may use Resharper (at least trial version if You do not have one) to find all usages of property PrescriptionViewModel.IsVisible and spot the issue place.

If You do not have property IsVisible in your PrescriptionViewModel You may want to temporarily (or not) create it and then apply "Find Usages" again.

Teaman
  • 177
  • 6
  • But that's the problem I'm trying to solve. The binding is not properly specified. The error says which view model, but does not say which view this error is coming from. – Ray Apr 11 '14 at 14:00