One of the probably most common things you do in WPF is specify Bindings. But how do you debug them?

In WPF 3.5 there is new diagnostics that you can turn on that will output detailed binding messages to the Output window. Immensely helpful when you are trying to debug why your binding does not work.

To set it up first add diagnostics to your namespace:

<Window x:Class=”Tester.Window2″

xmlns:diag=”clr-namespace:System.Diagnostics;assembly=WindowsBase”

Then enable it on per-binding instance as such:

ItemsSource=”{Binding Path=PaneItems, diag:PresentationTraceSources.TraceLevel=High}”

Now when you run your app watch Output window for clues on why binding is failing.

Hope this helps save your sanity while debugging bindings as much as it does mine 🙂

Professional looking applications made easy with DotNetBar for WinForms, Silverlight and WPF User Interface components. Click here to find out more.

Related posts:

  1. How To Customize WPF Binding Update Behavior
  2. New ColorInput Control In DotNetBar for WPF 5.2
  3. Unusual User Interface Design