PresentationTraceSources Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- Inheritance
-
PresentationTraceSources
The following sample configuration file enables tracing of animations, writing the output to a text file called "debug.txt". This configuration file can only be used with .NET Framework apps.
<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>
Debug tracing is only available when a WPF application is running in full trust mode.
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 in a .NET Framework app, 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.
Trace |
Identifies the TraceLevel attached property. |
Animation |
Gets an animation trace source. |
Data |
Gets a data-binding trace source. |
Dependency |
Gets a dependency property trace source. |
Documents |
Gets a document trace source. |
Freezable |
Gets a Freezable trace source. |
Hwnd |
Gets an hwnd host trace source. |
Markup |
Gets a markup trace source. |
Name |
Gets a name scope trace source. |
Resource |
Gets a resource dictionary trace source. |
Routed |
Gets a routed event trace source. |
Shell |
Gets a shell trace source. |
Get |
Gets the value of the TraceLevel attached property for a specified element. |
Refresh() |
Refreshes trace sources, by forcing the app.config file to be re-read. |
Set |
Sets the value of the TraceLevel attached property to a specified element. |
Product | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: