WPF mouse wheel event not firing when mouse over the map

730
6
Jump to solution
07-16-2021 12:56 PM
rodsan724
New Contributor II

My mouse wheel event not firing in my WPF app. What am I missing?

Screen Shot 2021-07-16 at 3.55.08 PM.png

Screen Shot 2021-07-16 at 3.57.33 PM.png

0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor

To instruct the MapView to navigate in response to button/slider reaction use one of the SetViewPoint...() asynchronous or synchronous methods: https://developers.arcgis.com/net/wpf/api-reference/html/Methods_T_Esri_ArcGISRuntime_UI_Controls_Ma....

To update the slider/UI in response to user interaction/navigation on the map, listen for the NavigationCompleted or ViewpointChanged events (careful with the latter because it fires frequently): https://developers.arcgis.com/net/wpf/api-reference/html/Events_T_Esri_ArcGISRuntime_UI_Controls_Map....

Also see this sample for some tips in programmatically navigating the view: https://developers.arcgis.com/net/wpf/sample-code/geoview-viewpoint-synchronization/.

 

View solution in original post

0 Kudos
6 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

Can you provide more details about the scenario you'd like to implement with mousewheel over the map view? 

Thanks

 

 

0 Kudos
rodsan724
New Contributor II

I'm trying to use ReactiveUI to synchronize a slider control, zoom in and out buttons, and the mouse wheel to control zooming on ArcGIS map.

I'm still in design phase...When I use the mouse wheel to zoom, I need the slider to auto update it's position relative to current zoom. I'm thinking in the mouse wheel event to set the slider somehow. I really don't know at this point how I'm going to coordinate all of these things with ReactiveUI. Any ideas are welcomed.

Here is my github that shows a map with a slider and zoom buttons but they are all still independent of each other. ReactiveUI can easily make this happen but I'm not really understanding ReactiveUI that well.

https://github.com/rodsantest1/ReactiveUI_Journey_Solution/tree/RxuiMapSliderMvp

rodsan724_0-1626467946975.png

rodsan724_4-1626468095223.png

rodsan724_5-1626468118113.png

rodsan724_6-1626468148511.png

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

To instruct the MapView to navigate in response to button/slider reaction use one of the SetViewPoint...() asynchronous or synchronous methods: https://developers.arcgis.com/net/wpf/api-reference/html/Methods_T_Esri_ArcGISRuntime_UI_Controls_Ma....

To update the slider/UI in response to user interaction/navigation on the map, listen for the NavigationCompleted or ViewpointChanged events (careful with the latter because it fires frequently): https://developers.arcgis.com/net/wpf/api-reference/html/Events_T_Esri_ArcGISRuntime_UI_Controls_Map....

Also see this sample for some tips in programmatically navigating the view: https://developers.arcgis.com/net/wpf/sample-code/geoview-viewpoint-synchronization/.

 

View solution in original post

0 Kudos
rodsan724
New Contributor II

Thanks Michael.

Quick question: what would I set the min and max values for slider to based on map zoom?

0 Kudos
dotMorten_esri
Esri Frequent Contributor

The mouse wheel event doesn't fire, because the mapview reacts on it. This is pretty typical for routed events in WPF. You can use the Preview* events instead, or choose to subscribe to events regardless of bubbling behavior. However from your scenario, as Mike is saying, use the info from the mapview instead to sync your slider - I'd recommend using the MapScale property to set your slider. You'll probably want to use a Log value of the scale though, since one "notch" on the slider, should double the scale value.

 what would I set the min and max values for slider to based on map zoom

That is entirely up to you and your map. If your map has min/max scales set, use that, but there's no guarantee there is a min/max.

0 Kudos
rodsan724
New Contributor II

Thank you for the extra info.

0 Kudos