我正在为 Windows Phone 7 使用 C#、Silverlight、Visual Studio。
我想获得一个剪辑,UIElement
其中包括在UIElement
.
这个例子给了我剪辑,但不包括来自 UIElement 的任何转换:
// uie is a UIElement taken from a PhoneApplicationPage
Geometry myClip = uie.Clip;
我尝试了以下方法,但最终移动了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;
我还尝试在最后添加一个逆变换来撤消任何运动,但这似乎使情况变得更糟:
uie.RenderTransform = gt.Inverse as Transform;
请帮助我获得具有原始变换的剪辑,而UIElement
不会弄乱它UIElement
本身。
提前致谢。