Wednesday, 25 June 2008

Rendering off-screen content with WPF

Lately I've been dallying with WPF, and have been beating my head against a wall trying to get some off screen rendering happening, here's the story:

I have a Grid, which programmatically gets rows/columns/children added behind the scenes.
I have wired up a ScaleTransform and a slider as per this awesome post allowing me to zoom in/out.

However I only get a variable size version of what was displayed on the screen, no new content comes into view >:(

Mass googling didn't help me, until I found somewhere that mentioned using the ClipToBounds property to _prevent_ content outside the bounds of the element being rendered.

Applying a ClipToBounds="False" to each valid element up my hierarchy has left me with data correctly being brought into view when I zoom out!

This seems painfully obvious now, but if you run into the same problem, hopefully this helps out!

No comments: