WP7/silverlight Images does not stay within a grid/stackpanel when using the toolkit to provide gesture support
- by gforg
I have few buttons and below that I am displaying an image and have used the WP7/Silverlight toolkit to provide support for Gestures. Everything works fine, until i do gestures like pinch and then moving it up/down. Both these gestures work fine but they do not seem to respect the stackpanel/grid the image is present in and they go over that and on top of the buttons. Do u know how to restrict these?
I see the following function when gestures are called.
private void OnPinchStarted(object sender, PinchStartedGestureEventArgs e)
{
initialAngle = ImageScaling.Rotation;
initialScale = ImageScaling.ScaleX;
}
private void OnPinchDelta(object sender, PinchGestureEventArgs e)
{
ImageScaling.Rotation = initialAngle + e.TotalAngleDelta;
ImageScaling.ScaleX = ImageScaling.ScaleY = initialScale * e.DistanceRatio;
}
private void OnDragDelta(object sender, DragDeltaGestureEventArgs e)
{
ImageScaling.TranslateX += e.HorizontalChange;
ImageScaling.TranslateY += e.VerticalChange;
}