Select to view content in your preferred language

Mouse Wheel events for MapControl

955
5
Jump to solution
03-05-2024 07:03 AM
AzharIbrahim
Occasional Contributor

I'm using a map in a map control as a secondary map in a pro window. I've tried to use the MouseWheel event and the PreviewMouseWheel event. Neither gets triggered. How should I be using these events? I didn't find anything in the two samples that are normally given for MapControl (overview and magnifier).  I'm creating a new map and adding layers which are then used to create the ViewContent for the MapControl. MapView.Active never points to the MapControl even when I'm using the MapControl map, so those options are not available..

I can get the mouse move event, but not the mouse left button down or mouse hweel. This includes the preview.

I'm currently still using version 3.0.3.

 

0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

This is not currently supported. Thank u for the requirement. We will look into adding event subscription for the control at 3.4.

View solution in original post

0 Kudos
5 Replies
CharlesMacleod
Esri Regular Contributor

This is not currently supported. Thank u for the requirement. We will look into adding event subscription for the control at 3.4.

0 Kudos
AzharIbrahim
Occasional Contributor

Thank you for looking into this. Since the documentation includes mouse events for the map control it's a bit confusing as to what is actually supported.

0 Kudos
CharlesMacleod
Esri Regular Contributor

can u point me to the incorrect documentation please? I did a quick scan of https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Map-Exploration#mapcontrol  but didnt see a reference to Mouse events....I wld like to correct it.

 

fyi: perhaps because u r "seeing" the inherited events from the base WPF UIElement class on the api reference? https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic12547.html#EventsBookmark 

If u uncheck "Include Inherited Members" u will see only the events implemented on the map control itself

api-ref-uncheck.jpg

 

0 Kudos
AzharIbrahim
Occasional Contributor

That was it. thank you. I did get the mouse enter event to work, but none of the others.

0 Kudos
ArchieJain
New Contributor

I am using version 3.4, but the mouse events are not being triggered. I have tried using the MouseWheel event, the PreviewMouseWheel event, and other mouse events, but none of them are triggered. However, events like MouseMove, MouseEnter, and MouseLeave are triggered.

I am working on a dockpane that displays a map using the MapControl with the ViewContent method, and I have added layers to the map.

 

This is how i am subscribing to an event 
this.MapControls.PreviewMouseWheel += MapControls_PreviewMouseWheel;

And here is the event handler:

private void MapControls_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
MessageBox.Show("MapControls_PreviewMouseWheel intercepted!");
e.Handled = true; // Disable default zoom
}

0 Kudos