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

3467
5
Jump to solution
04-13-2015 07:44 AM
AnatoliiTerentiev
Occasional Contributor III

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
Occasional 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
Occasional Contributor III

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
Occasional Contributor
  1. myMap.MouseClick += new EventHandler<Map.MouseEventArgs>(Map_MouseLeftButtonDown); 
  2. Not Check but this should work

View solution in original post

AnatoliiTerentiev
Occasional Contributor III

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
Occasional Contributor

i think this will help you

e.Handled = true;

AnatoliiTerentiev
Occasional Contributor III

Did not help.

0 Kudos