I must print a displayed TreeView.
Rendering the root TreeViewItem to bitmap, gives me an image of the whole (even non visible nodes) tree. Then I split the bitmap in "pages" to be printed. The rendering code:
m_Bitmap = new RenderTargetBitmap((int)l_RootTreeViewItem.ActualHeightDesiredSize.Width,
(int)l_RootTreeViewItem.ActualHeight, 96, 96,
PixelFormats.Pbgra32);
m_Bitmap.Render(l_RootTreeViewItem);
Works well for small size trees. If the tree is large, RenderTargetBitmap results in "Out Of Memory" Exception.
So, the idea is to render only parts of the visual to avoid memory problems. A Render method where I can choose which part of visual to render will be perfect...
m_Bitmap.Render(l_RootTreeViewItem, xOffset, yOffset, width, height);
... but doesn't exist. Is there some way to do that ?