PresentationTraceSources PresentationTraceSources PresentationTraceSources PresentationTraceSources Class


Provides debug tracing support that is specifically targeted for Windows Presentation Foundation (WPF) applications.

public ref class PresentationTraceSources abstract sealed
public static class PresentationTraceSources
type PresentationTraceSources = class
Public Class PresentationTraceSources


The following sample configuration file enables tracing of animations, writing the output to a text file called "debug.txt".

      <source name="System.Windows.Media.Animation"  
switchName="SourceSwitch" >  
          <add name="textListener" />  
      <add name="SourceSwitch" value="All" />  
      <add name="textListener"  
           initializeData="Debug.txt" />  
    <trace autoflush="true" indentsize="4"></trace>  


Debug tracing is only available when a WPF application is running in full trust mode.

In order to enable tracing, you first must set a registry key, then you must configure trace sources.

  • To create the registry key, set a "ManagedTracing" reg_dword value to 1 under "HKeyCurrentUser\Software\Microsoft\Tracing\WPF".

  • To configure trace sources, create an application config file. This file has a .config extension, for example, XamlPad.exe.config.

Achieving optimal application performance requires forethought in application design and an understanding of best practices for Windows Presentation Foundation (WPF) application development. For more information, see Optimizing WPF Application Performance.


TraceLevelProperty TraceLevelProperty TraceLevelProperty TraceLevelProperty

Identifies the TraceLevelProperty attached property.


AnimationSource AnimationSource AnimationSource AnimationSource

Gets an animation trace source.

DataBindingSource DataBindingSource DataBindingSource DataBindingSource

Gets a data-binding trace source.

DependencyPropertySource DependencyPropertySource DependencyPropertySource DependencyPropertySource

Gets a dependency property trace source.

DocumentsSource DocumentsSource DocumentsSource DocumentsSource

Gets a document trace source.

FreezableSource FreezableSource FreezableSource FreezableSource

Gets a Freezable trace source.

HwndHostSource HwndHostSource HwndHostSource HwndHostSource

Gets an hwnd host trace source.

MarkupSource MarkupSource MarkupSource MarkupSource

Gets a markup trace source.

NameScopeSource NameScopeSource NameScopeSource NameScopeSource

Gets a name scope trace source.

ResourceDictionarySource ResourceDictionarySource ResourceDictionarySource ResourceDictionarySource

Gets a resource dictionary trace source.

RoutedEventSource RoutedEventSource RoutedEventSource RoutedEventSource

Gets a routed event trace source.

ShellSource ShellSource ShellSource ShellSource

Gets a shell trace source.


GetTraceLevel(Object) GetTraceLevel(Object) GetTraceLevel(Object) GetTraceLevel(Object)

Gets the value of the TraceLevelProperty attached property for a specified element.

Refresh() Refresh() Refresh() Refresh()

Refreshes trace sources, by forcing the app.config file to be re-read.

SetTraceLevel(Object, PresentationTraceLevel) SetTraceLevel(Object, PresentationTraceLevel) SetTraceLevel(Object, PresentationTraceLevel) SetTraceLevel(Object, PresentationTraceLevel)

Sets the value of the TraceLevelProperty attached property to a specified element.

Applies to

See also