Add an event handler to update canvas background color just before it is rendered.ĬompositionTarget.Rendering += UpdateColor The following example shows how you register an EventHandler delegate to the static Rendering method on CompositionTarget.
The Rendering event fires during the WPF rendering process. For a complete code sample using CompositionTarget, see Using the CompositionTarget Sample.