Export (0) Print
Expand All

PresentationTraceSources Class

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

System.Object
  System.Diagnostics.PresentationTraceSources

Namespace:  System.Diagnostics
Assembly:  WindowsBase (in WindowsBase.dll)

public static class PresentationTraceSources

The PresentationTraceSources type exposes the following members.

  NameDescription
Public propertyStatic memberAnimationSourceGets an animation trace source.
Public propertyStatic memberDataBindingSourceGets a data-binding trace source.
Public propertyStatic memberDependencyPropertySourceGets a dependency property trace source.
Public propertyStatic memberDocumentsSourceGets a document trace source.
Public propertyStatic memberFreezableSourceGets a Freezable trace source.
Public propertyStatic memberHwndHostSourceGets an hwnd host trace source.
Public propertyStatic memberMarkupSourceGets a markup trace source.
Public propertyStatic memberNameScopeSourceGets a name scope trace source.
Public propertyStatic memberResourceDictionarySourceGets a resource dictionary trace source.
Public propertyStatic memberRoutedEventSourceGets a routed event trace source.
Public propertyStatic memberShellSourceGets a shell trace source.
Top

  NameDescription
Public attached propertyTraceLevelGets or sets a value that specifies the level of detail to trace about a particular object.
Top

  NameDescription
Public methodStatic memberGetTraceLevelGets the value of the TraceLevel attached property for a specified element.
Public methodStatic memberRefreshRefreshes trace sources, by forcing the app.config file to be re-read.
Public methodStatic memberSetTraceLevelSets the value of the PresentationTraceSources.TraceLevel attached property to a specified element.
Top

  NameDescription
Public fieldStatic memberTraceLevelPropertyIdentifies the TraceLevel attached property.
Top

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.

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

<configuration>
  <system.diagnostics>
    <sources>
      <source name="System.Windows.Media.Animation"
switchName="SourceSwitch" >
        <listeners>
          <add name="textListener" />
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="SourceSwitch" value="All" />
    </switches>
    <sharedListeners>
      <add name="textListener"
           type="System.Diagnostics.TextWriterTraceListener"
           initializeData="Debug.txt" />
    </sharedListeners>
    <trace autoflush="true" indentsize="4"></trace>
  </system.diagnostics>
</configuration>

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft