简体   繁体   中英

Touch events interception and routing

I have a MapControl and I am showing a MapIcon in the center of the map, which I update every second and center again. This works nice.

But now, I am trying to disable all gestures and touch events for the MapControl without success. The closest I have been to accomplish this is disabling all the four InteractionModes like PanInteractionMode. But if you try to drag the map with two fingers, it is still dragged and this is not acceptable.

On top on that, the MapControl is inside a Pivot control and I would like to route the MapControl events towards the Pivot so it can detect swipe gestures over the map too.

Am I dreaming too much?

When I set the following four interaction modes to Disabled , I can no longer interact with the map. I am on Windows 10 Creators Update.

But even with them plus setting IsHitTestVisible to False , the MapControl would still swallow any input. The workaround is to overlay a transparent Rectangle . This way the swipe on Pivot will work again.

<PivotItem Header="PivotItem 0">
    <Grid>
        <Maps:MapControl PanInteractionMode="Disabled"
                         RotateInteractionMode="Disabled"
                         TiltInteractionMode="Disabled"
                         ZoomInteractionMode="Disabled"
                         IsHitTestVisible="False" />
        <Rectangle Fill="Transparent" />
    </Grid>
</PivotItem>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM