PresentationTraceSources Class

 

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

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

System.Object
  System.Diagnostics.PresentationTraceSources

Public NotInheritable Class PresentationTraceSources

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticAnimationSource

Gets an animation trace source.

System_CAPS_pubpropertySystem_CAPS_staticDataBindingSource

Gets a data-binding trace source.

System_CAPS_pubpropertySystem_CAPS_staticDependencyPropertySource

Gets a dependency property trace source.

System_CAPS_pubpropertySystem_CAPS_staticDocumentsSource

Gets a document trace source.

System_CAPS_pubpropertySystem_CAPS_staticFreezableSource

Gets a Freezable trace source.

System_CAPS_pubpropertySystem_CAPS_staticHwndHostSource

Gets an hwnd host trace source.

System_CAPS_pubpropertySystem_CAPS_staticMarkupSource

Gets a markup trace source.

System_CAPS_pubpropertySystem_CAPS_staticNameScopeSource

Gets a name scope trace source.

System_CAPS_pubpropertySystem_CAPS_staticResourceDictionarySource

Gets a resource dictionary trace source.

System_CAPS_pubpropertySystem_CAPS_staticRoutedEventSource

Gets a routed event trace source.

System_CAPS_pubpropertySystem_CAPS_staticShellSource

Gets a shell trace source.

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticTraceLevel

Gets or sets a value that specifies the level of detail to trace about a particular object.

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticGetTraceLevel(Object)

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

System_CAPS_pubmethodSystem_CAPS_staticRefresh()

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

System_CAPS_pubmethodSystem_CAPS_staticSetTraceLevel(Object, PresentationTraceLevel)

Sets the value of the PresentationTraceSources.TraceLevel attached property to a specified element.

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticTraceLevelProperty

Identifies the TraceLevel attached property.

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
Available since 3.0

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

Return to top
Show: