I am using C#, Silverlight, Visual Studio for Windows Phone 7.
I would like to get the Clip of a UIElement
that includes any transform that has been done on the UIElement
.
This example gives me the Clip but does not include any transform from the UIElement:
// uie is a UIElement taken from a PhoneApplicationPage
Geometry myClip = uie.Clip;
I tried the following, but it ended up moving the UIElement
:
var frame = Application.Current.RootVisual as PhoneApplicationFrame;
var page = frame.Content as PhoneApplicationPage;
GeneralTransform gt = uie.TransformToVisual(page);
uie.RenderTransform = gt as Transform;
Geometry myClip = uie.Clip;
I also tried to add an inverse transform at the end to undo any movement, but that seemed to make it worse:
uie.RenderTransform = gt.Inverse as Transform;
Please help me get the Clip with the original transform of the UIElement
without messing with the UIElement
itself.
Thanks in advance.