Rendering WPF DrawingGroup to single ImageSource

Posted by Xander on Stack Overflow See other posts from Stack Overflow or by Xander
Published on 2009-08-28T12:20:59Z Indexed on 2010/06/01 8:23 UTC
Read the original article Hit count: 1289

Filed under:
|
|
|
|

Currently I'm using a System.Windows.Media.DrawingGroup to store some tiled images (ImageDrawing) inside the Children-DrawingCollection property. Well the problem is now, this method gets really slow if you display the entire DrawingGroup in an Image control, because my DrawingGroup can contain hundreds or even thousands of small images it can really mess up the performance.

So my first thought was to somehow render a single image from all the small ones inside the DrawingGroup and then only display that image, that would be much faster. But as you might have figured out I haven't found any solution so simply combine several images with WPF Imaging.

It would really be great if someone could help with this problem or tell me how i can improve the performance with the DrawingGroup or even use another approach.

One last thing, currently I'm using a RenderTargetBitmap to generate a single BitmapSource from the DrawingGroup, this approach isn't really faster, but it makes the scrolling and working on the Image control at least a little smoother.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET