Possible Duplicate:
Improving Canvas performance
in my wpf application I load a image as bitmap and draw it as a background on my control. On this picture I want to draw some geometries, for example ellipses. So i have to recieve mouseclick and mousemove events in this control for knowing where to draw my geometry.
Actually I derive my control class from the "canvas" class, but i fullscreen this is to slow. And if I derive from the "control" class, only mouse events on allready drawn images or geometries can be recieved.
So the Question is: What is the best class to derive from in WPF for drawing some geometries with the best performance and where alway mouse events can occure?
Thanks :)
For WPF the best performing drawing can be achieved using DrawingVisual. These are one-time created classes that hold a specific geometry to be rendered on the screen. This is better than overriding OnRender as the OnRender event basically recreates your entire control each refresh whereas only objects that change need to be updated using DrawingVisual
If you still need more performance try WriteableBitmapEx, this is a silverlight & WPF library for drawing directly onto a bitmap. Its blazingly fast but won't give all the features that you will be accustomed to in WPF rendering.