How can i find the location of the 'SomeRectangle' ?
This Rectangle is the location and the size that i need to crop from t开发者_开发知识库he 'somepicture' that is actually the picture that appear in the background of the main grid.
<Rectangle x:Name="SomeRectangle" Height="50" Width="50" Stroke="Red" HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="5" MinHeight="5" />
GeneralTransform gt =
SomeRectangle.TransformToVisual(Application.Current.RootVisual as UIElement);
Point offset = gt.Transform(new Point(0, 0));
double controlTop = offset.Y;
double controlLeft = offset.X;
Source: Silverlight Forum
精彩评论