Is there any way to effectively debug WPF data bindings?

前端 未结 5 1570
别跟我提以往
别跟我提以往 2021-02-13 16:18

I am having a data binding problem (a separate question), and normally when I code, I can use the debugger to step through, and hit break points. What is probably a simple issu

5条回答
  •  遥遥无期
    2021-02-13 16:30

    I have no idea if VS provides an easy way to debug bindings, but I usually use Snoop for debugging bindings

    It's a tool that will go through a WPF application and give you a TreeView of the application's Visual Tree. You can select an element to view its DataContext and other properties. If there are any binding errors, the property is usually highlighted and it will say what the error was. If the binding is failing because the property doesn't exist, I can usually trace the DataContext and figure out where I went wrong in my binding.

提交回复
热议问题