Debugging WPF bindings

WPF and bindings can cause a lot of stress when your data binding doesn’t seems to work. From .Net 3.5 and up, you can enable trace information regarding bindings.

Add the following namespace in the header of your component:


To your binding, add the following line:

For example:

<Window x:Class="DatabindingExample" xmlns=""
 Title="MyWindow" Height="300" Width="300">
 <TextBox Text="{Binding Path=Name, diag:PresentationTraceSources.TraceLevel=High}" />
Also, to view the tracing, it is important to change the log level of Visual Studio regarding WPF. Go to Tools->Options, a dialog will appear. Click on the left on “Debugging->Output window”. You will see within the section “WPF Trace Settings” a line for binding. Set the loglevel for this on at least “Warning”.
Posted in C#, WPF at June 14th, 2012. No Comments.