ThinkGeo.com    |     Documentation    |     Premium Support

Wpf map looses focus

I develop an application using Mapsuite10 for WPF. The map that is in the main form of the project looses focus whenever I open a new popup form. In other words, I open a popup form, and the wheel of the mouse stop working after that. And I must click somewhere in the main form (not in the map) and then click again in the map to make the wheel to work again.
I have used this event

Private Sub wp_MouseEnter(sender As Object, e As System.Windows.Input.MouseEventArgs) Handles wp.MouseEnter
wp.Focus()
End Sub

and nothing changed.
I have also noticed that the wheel stops working when I use dual monitor (the wheel stops working after I click to the other monitor).

How can I fix it?

Hi Marios,

This scenario is correct and it works fine by design. The reason we’re so designed is as follows:

  1. Windows system will send the mouse wheel event to the control, pane, or window that the pointer is currently over, so setting the map focus is invalid.
  2. When zooming map by mouse wheel, the center point of zooming map is base on the position of mouse, so the mouse must be located within the map.

Wish that’s helpful.

If you have any questions, please feel free to contact us.

Thanks,
Rex

The wheel does not even work when I place the mouse above the map (after I have clicked to another form or the second monitor). It does not work even if I click again the map. For some reason I must click somewhere in my form (the same form that the map is in) and then click the map. After those actions wheel starts working. Any solution?

Hi Marios,

We created a sample to test, but didn’t reproduce your issue.

Please give us more details. If it’s possible, please give us a sample to recreate your issue.

Thanks,
Rex