I used a canvas to render some long contents( for example texts, images, shapes, etc., of few pages) in WPF. When I scale it using Scale transform, it scales and the memory usage was under control. Now, I have an idea of using few image control in the canvas and rendered the above contents. But, when I scale up it as of same , memory gets increased to a large amount and when i scale down, the memory decreases. What could be the problem.
Code I used:
Image imagecntrl = new Image();
RenderTargetBitmap bitmap = new RenderTargetBitmap((int)(controlSize.Width * m_zoomFactor), (int)(controlSize.Height * m_zoomFactor), 96, 96, PixelFormats.Pbgra32);
bitmap.Render(pageVisual); //pageVisual is the DrawingVisual which contains the contents i mentioned earliar.
imagecntrl.Source = bitmap;
return imagecntrl;