How to locate the source of a binding error?

前端 未结 5 447
Happy的楠姐
Happy的楠姐 2020-12-08 05:05

How can I figure out what line of xaml contains the troublesome binding When my debug output is full of lines like the following:

System.Windows.Data Error: 5

5条回答
  •  旧巷少年郎
    2020-12-08 05:53

    You can add this to every control that binds

      PresentationTraceSources.TraceLevel="High" 
    

    And run the program in debug, the detailed binding information will appear in your Output window. It may help a bit. You can also create a pass though converter to catch an error (catches the problem some times but not always). There are no good tools for debugging XAML in general that I am aware of.

提交回复
热议问题