tags:

views:

239

answers:

2

Hi,

I have a UserControl which has a quadratic Image as a Child. This Image is at the bottom of the UserControl, and half of it is clipped (e.g. the Control's Height is 400, Image's height is 200 and it is set to y=300).

Now, When I rotate the Image, it is still clipped like the way it was first. Like when rotating around 90 degrees, I suddenly have an Image which is only 100px wide.

It seems like the original clipping which was made because of the bounds of the UserControl, are applied forever.

How do I solve this problem? I hope I explained my problem understandable ;)

A: 

How are you rotating the image? If you are rotating using a RenderTransform, then WPF does not re-render what was already displayed on the screen - it simply rotates the pixels.

Instead, rotate the image using a LayoutTransform; this forces WPF to re-render the control given the new area it occupies, which should eliminate the clipping you see.

Nicholas Armstrong
Awesome, Thanks a lot :)
Thomas
A: 

You can also call InvalidateMeasure() after applying render transform. I think it will also work.

Alok