WPF - Text in ContentControl doesn't move past certain X-Coordinate in big picture rendered with RenderTargetBitmap

Tobias Kunkel 1 Reputation point
2020-07-07T08:46:40.883+00:00

Hi,

I have an odd issue, we have a big image (about 13000 pixels wide). We display that in a canvas, and put some ContentControls on top of it. Each ContentControl has a Rectangle to act as a background and a ViewBox which has a TextBlock as a child.

The canvas is then Measured and Arranged and rendered to a RenderTargetBitmap.

The issue is that once those ContentControls move beyond approximately 11000px on the image, you see the text inside the ContentControl shift to the left rather than being centered, until it leaves the ContentControl completely and thus isn't visible anymore. This only happens on the RenderTargetBitmap Output though. I cannot find any documentation on why that would be.

Using VisualBrush inbetween seems to solve this issue, but the resulting image has a very low quality.

I'll see if I can provide a minimal example if needed.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,706 questions
{count} votes