Sometime you can have some errors in the XAML Binding. The binding is defined as a string which doesn’t allow to detect errors at compile time. Here are some informations and techniques I could gather on the subject during my self-training on WPF.

Traces

Types of traces

System.Windows.Data

This trace is probably the most useful. It provides all sorts of information about the WPF DataBinding, even the warnings when it is impossible to resolve the binding. This trace does one thing that others do not: it activates automatically when you start the program in debug mode. To see it, just go to the Debug part of the Output Window.

System.Windows.DependencyProperty

Probably the least useful trace. It just provides information about the DependencyProperties. It does not, however, provide any information on the assignment or calculation of this property.

System.Windows.Freezable

Used to trace freeze problems that do not generate an exception. For example, if you call the CanFreeze method and return false, this trace can help you determine exactly what could not be frozen.

System.Windows.RoutedEvent

Allows tracing on the path of RoutedEvents. This includes a trace indicating which EventListener handled the event.

System.Windows.Media.Animation

Send traces when animations are: started, stopped, paused, restarted, etc.

System.Windows.NameScope

Sends a trace when a name is saved. It provides the name and the object.

System.Windows.ResourceDictionary

Send traces when a resource is created, deleted, used, etc. Because it is possible to have multiple resource dictionaries that define the same resource, it can be useful to determine exactly where this resource comes from.

System.Windows.Markup

Send traces when XAML (where BAML) is loaded, with information such as created objects, populated properties, and type of converters (converter) used.

System.Windows.Documents

Traces information about page formatting errors for paginated documents.

Activating and using traces

The activation of traces is done in the project’s app. config file. In this file just create in the part <configuration><sytems.diagnostics>..</sytems.diagnostics></configuration> three sections.

The first one will be <sources> containing the definition of traces.

The second is <switches> that will define the information level of the messages provided.

The third is <sharedListeners> that will define the output mode of the information.

Below is an example of all traces and sections.

<configuration>
    <system.diagnostics>
        <sources>
        <!--
            <source name="System.Windows.Data" switchName="SourceSwitch">
                <listeners>
                    <add name="textListener" />
                </listeners>
            </source>
        -->
        <!--
            <source name="System.Windows.DependencyProperty" switchName="SourceSwitch">
                <listeners>
                    <add name="textListener" />
                </listeners>
            </source>
        -->
        <!--
            <source name="System.Windows.Freezable" switchName="SourceSwitch">
                <listeners>
                    <add name="textListener" />
                </listeners>
            </source>
        -->
        <!--
            <source name="System.Windows.RoutedEvent" switchName="SourceSwitch">
                <listeners>
                    <add name="textListener" />
                </listeners>
            </source>
        -->
        <!--
            <source name="System.Windows.Media.Animation" switchName="SourceSwitch">
                <listeners>
                    <add name="textListener" />
                </listeners>
            </source>
        -->
        <!--
            <source name="System.Windows.NameScope" switchName="SourceSwitch">
                <listeners>
                    <add name="textListener" />
                </listeners>
            </source>
        -->
        <!--
            <source name="System.Windows.ResourceDictionary" switchName="SourceSwitch">
                <listeners>
                    <add name="textListener" />
                </listeners>
            </source>
        -->
        <!--
            <source name="System.Windows.Markup" switchName="SourceSwitch">
                <listeners>
                    <add name="textListener" />
                </listeners>
            </source>
        -->
        <!--
            <source name="System.Windows.Documents" switchName="SourceSwitch">
                <listeners>
                    <add name="textListener" />
                </listeners>
            </source>
        -->
        </sources>
        <switches>
            <add name="SourceSwitch" value="All" />
            <!--add name="SourceSwitch" value="Off" -->
            <!--add name="SourceSwitch" value="Verbose" -->
            <!--add name="SourceSwitch" value="Warning" -->
            <!--add name="SourceSwitch" value="Activity" -->
        </switches>
        <sharedListeners>
            <!-- Ce listener envoi la sortie dans la console -->
            <add name="console"
                type="System.Diagnostics.ConsoleTraceListener"
                initializeData="false"/>
            <!-- Ce listener envoi la sortie 
                dans un fichier XML nommé AvTrace.xml -->
            <add name="xmlListener"
                type="System.Diagnostics.XmlWriterTraceListener"
                traceOutputOptions="None"
                initializeData="AvTrace.xml" />
            <!-- Ce listener envoi la sortie
                dans un fichier nommé AvTrace.txt -->
            <add name="textListener"
                type="System.Diagnostics.TextWriterTraceListener"
                initializeData="AvTrace.txt" />
        </sharedListeners>
        <trace autoflush="true" indentsize="4"></trace>
    </system.diagnostics>
</configuration>

Source : http://blogs.msdn.com/b/mikehillberg/archive/2006/09/14/wpftracesources.aspx