WP7/silverlight Images does not stay within a grid/stackpanel when using the toolkit to provide gesture support
        Posted  
        
            by 
                gforg
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by gforg
        
        
        
        Published on 2011-01-09T05:49:24Z
        Indexed on 
            2011/01/09
            5:53 UTC
        
        
        Read the original article
        Hit count: 290
        
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;
    }
© Stack Overflow or respective owner