Export (0) Print
Expand All

CompositionTarget.Rendering Event

Occurs just before the objects in the composition tree are rendered.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public:
static event EventHandler^ Rendering {
	void add (EventHandler^ value);
	void remove (EventHandler^ value);
}
/** @event */
public static void add_Rendering (EventHandler value)

/** @event */
public static void remove_Rendering (EventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
<object Rendering="EventHandler" .../>

The Rendering event is routed to the specified event handler after animation and layout have been applied to the composition tree.

The Rendering event fires during the Windows Presentation Foundation (WPF) rendering process. The following example shows how you register an EventHandler delegate to the static Rendering method on CompositionTarget.

// Add an event handler to update canvas background color just before it is rendered.
CompositionTarget.Rendering += UpdateColor;

You can use your rendering event handler method to create custom drawing content. This event handler method gets called once per frame. Each time that Windows Presentation Foundation (WPF) marshals the persisted rendering data in the visual tree across to the composition tree, your event handler method is called. In addition, if changes to the visual tree force updates to the composition tree, your event handler method is also called. Note that your event handler method is called after layout has been computed. However, you can modify layout in your event handler method, which means that layout will be computed once more before rendering.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft