ThinkGeo.com    |     Documentation    |     Premium Support

TrackInteractiveOverlay KeyDown Event Not Triggered

Hello,

I am trying to tie into a keypress event while in the TrackInteractiveOverlay and none of the events fire on any keypress.

I saw a post from 2012 on these forums that mentioned the same issue with the InteractiveOverlay class, which was fixed at that time - I am wondering if this issue is related.

Below are the methods I override in my class that inherits from TrackInteractiveOverlay, and none of these 4 functions are ever triggered.

    protected override InteractiveResult KeyDownCore(KeyEventInteractionArguments interactionArguments)
    {
        return base.KeyDownCore(interactionArguments);
    }

    protected override void OnMapKeyDown(MapKeyDownInteractiveOverlayEventArgs e)
    {
        base.OnMapKeyDown(e);
    }

    protected override InteractiveResult KeyUpCore(KeyEventInteractionArguments interactionArguments)
    {
        return base.KeyUpCore(interactionArguments);
    }

    protected override void OnMapKeyUp(MapKeyUpInteractiveOverlayEventArgs e)
    {
        base.OnMapKeyUp(e);
    }

Hey @Steve_Jackson,

What version of the nuget packages are you using. I am using the latest and not seeing this issue. You’ll want to use the OnMap specific events. So, for instance, this is my class:

class MyTrackInteractiveOverlay : TrackInteractiveOverlay
{
    protected override void OnMapKeyDown(MapKeyDownInteractiveOverlayEventArgs e)
    {
        Debug.WriteLine($"custom {e.InteractionArguments.Key}");
        base.OnMapKeyDown(e);
    }
}

Here’s how I set it up on my map:

private void MapView_Loaded(object sender, RoutedEventArgs e)
{
    mapView.MapUnit = GeographyUnit.Meter;

    mapView.TrackOverlay = new MyTrackInteractiveOverlay();
    mapView.TrackOverlay.MapKeyDown += TrackOverlayOnMapKeyDown;
}

private void TrackOverlayOnMapKeyDown(object sender, MapKeyDownInteractiveOverlayEventArgs e)
{
    Debug.WriteLine($"Key down event {e.InteractionArguments.Key}");
}

And here’s the output:

image

Thanks,
Kyle

Thanks Kyle! We are using 12.0.0.0 currently, I will try updating to the latest release in the next week or so and see if that resolves the issue for me. I mimicked your logic with the build I am using and still could not capture the event.

Hey @Steve_Jackson,

Ok, yeah, I would recommend updating to v12.4.1 to start. Then upgrade to v13.0.0 once you know your application is running properly.

Thanks,
Kyle