Search code examples
windows-phone-7canvassilverlight-toolkitoverlapoverlapping

WP7 overlapping images


I tried to place a photo frame (image) on a picture using code

<Canvas>
   <Image x:Name="picture" Source="{Binding XXX}" Canvas.ZIndex="1">
       <Image.RenderTransform>
            <TransformGroup>
                <MatrixTransform x:Name="previousTransform" />
                <TransformGroup x:Name="currentTransform">
                    <ScaleTransform x:Name="scaleTransform" />
                    <RotateTransform x:Name="rotateTransform" />
                    <TranslateTransform x:Name="translateTransform" />
                </TransformGroup>
            </TransformGroup>
       </Image.RenderTransform>

                <toolkit:GestureService.GestureListener>
                        <toolkit:GestureListener DragStarted="OnGestureListenerDragStarted" DragDelta="OnGestureListenerDragDelta" DragCompleted="OnGestureListenerDragCompleted" PinchStarted="OnGestureListenerPinchStarted" PinchDelta="OnGestureListenerPinchDelta" PinchCompleted="OnGestureListenerPinchCompleted"/>
                    </toolkit:GestureService.GestureListener>
            </Image>

   <Image x:Name="photoframe" Source="{Binding XXX}" Canvas.ZIndex="2"/>
</Canvas>

But it seems that the gestureService is no longer working if I overlap these two photoes using above code.

What I want is that placing a photo frame over a picture but no losing the gesture control (dragging or pinching the picture).

Thanks.


Solution

  • The photoframe is capturing the touch events of your image, because it is on top of your image. If you set the gestureservice on the photoframe, it will work again. Maybe setting the IsHitTestVisible of the photoframe to false will solves your problem too (I never tested it).

    Greets