Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
 Rendering Event
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
CompositionTarget..::.Rendering Event

Updated: November 2007

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

Namespace:  System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/xaml/presentation

Visual Basic (Declaration)
Public Shared Event Rendering As EventHandler
Visual Basic (Usage)
Dim handler As EventHandler

AddHandler CompositionTarget.Rendering, handler
C#
public static event EventHandler Rendering
Visual C++
public:
static  event EventHandler^ Rendering {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
J#
/** @event */
public static void add_Rendering (EventHandler value)
/** @event */
public static void remove_Rendering (EventHandler value)
JScript
JScript does not support events.
XAML Attribute Usage
<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 is raised 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.

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

You can use your rendering event handler to create custom drawing content. This event handler 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 is called. In addition, if changes to the visual tree force updates to the composition tree, your event handler is also called. Note that your event handler is called after layout has been computed. However, you can modify layout in your event handler, which means that layout will be computed once more before rendering.

Windows Vista

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

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker