Select to view content in your preferred language

Using the mouse event handling in mvvm while maintaining default shortcut keys

4105
5
Jump to solution
04-13-2015 07:44 AM
AnatoliiTerentiev
Deactivated User

Dear Gurus!

When I try to use mouse event handlers  (mouse click and mouse move handlers) in silverlight application default shortcut keys for zooming operation (Left mouse + Sthif Key + Drag)   do not work. How to fix?

0 Kudos
1 Solution

Accepted Solutions
Asgharkhan
Regular Contributor
  1. myMap.MouseClick += new EventHandler<Map.MouseEventArgs>(Map_MouseLeftButtonDown); 
  2. Not Check but this should work

View solution in original post

5 Replies
AnatoliiTerentiev
Deactivated User

I solved the problem by replacing MouseButtonEventHandler on MouseClick event handler. It was so:

myMap.MouseLeftButtonDown += new MouseButtonEventHandler(Map_MouseClick);

and now I did so:

myMap.MouseClick += new EventHandler<Map.MouseEventArgs>(Map_MouseClick);

and all works fine,  but it is interesting how to use the first MouseLeftButtonDown event?

0 Kudos
Asgharkhan
Regular Contributor
  1. myMap.MouseClick += new EventHandler<Map.MouseEventArgs>(Map_MouseLeftButtonDown); 
  2. Not Check but this should work
AnatoliiTerentiev
Deactivated User

I noticed that on the one-click event handler is called 2 times. What may be the reason and how to fix?

This is the code in the ViewModel:

myMap.MouseClick += new EventHandler<Map.MouseEventArgs>(Map_MouseClick);

 private void Map_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
{
 }
0 Kudos
Asgharkhan
Regular Contributor

i think this will help you

e.Handled = true;

AnatoliiTerentiev
Deactivated User

Did not help.

0 Kudos