Select to view content in your preferred language

MouseWheel support in Silverlight

1130
5
08-31-2010 08:40 AM
JakubGutkowski
Emerging Contributor
How can I subscribe for the MouseWheel event in ESRI Silverlight Map control? as I can't do  this declarative (from XAML) and imperative (from CodeBehind). Event is not fired.

If I can't  hookup for the mouse wheel event, how can I change yours zoomThrottleTimer Interval TimeSpan? I can't do this by reflection as SL does not support fully reflections - I mean System.Reflection not "graphic reflection".

I just don't get it, you've added MouseWheel support that you are not allowing us to change it, you have zoom throttle timer but you do not allow us to change it. You have a map control, which is sealed - why is that? you are closing yourself for extensions from a community.
0 Kudos
5 Replies
dotMorten_esri
Esri Notable Contributor
We did not add any mousewheel support. This comes out of the box since Silverlight 3.
We do listen for the event and perform a zoom.
I don't get why you can't add this from XAML. Works fine for me. However your might want to see the limitations mentioned about Silverlight and some platforms/browsersettings on MSDN.
The is absolutely no reason to change the zoomThrottleTimer. This is only a timer used for optimization (basically prevent overloading the server that you are hitting). I don't see why you would need to change this.


You have a map control, which is sealed - why is that? you are closing yourself for extensions from a community.


I'd love to hear what it is that you need that requires you to inherit from the map control. There are many ways to extend. Subclassing is only one, and depending on the use case quite often not even the best solution. That's why I'd like to understand your use case.
0 Kudos
JakubGutkowski
Emerging Contributor
I don't get why you can't add this from XAML. Works fine for me


In SL 4 and ArcGIS SL API 2.0 it does not work on my two separate installation on 2 different computers. Whenever I'm adding event it is not fired. I've tried adding breakpoints, Dubug.WriteLine(), throw new Exception, clearing cache, cleaning solution, rebuilding, rebuilding on diff computer. Nothing works. Event MouseWheel is not fired.

I've tested this on IE 8, FF, Chrome and Opera as I've saw in your code that you provide "different" mouse wheel support depending on the browser.

However your might want to see the limitations mentioned about Silverlight and some platforms/browsersettings on MSDN.


IMO, above you can find answer to this quote.

I'd love to hear what it is that you need that requires you to inherit from the map control


at the moment? mouse wheel support which is not working as an event for me. I'm not saying that mouse wheel is not working at all - it's working (zoom in/out on every browser I've tested), but I can't hook up/register for that event.

I had two options:

  1. hook up for the event and provide my functionality for zooming,

  2. inherit control so I could easy add my extension to method and than call base.OnMouseWheel (yup I know, this event does not exist in your map control, your are using MouseWheelHelper and you provide Scroll event for the map) so I will not need to write zooming, or at leat I could delay zoom operation for X milliseconds. Which IMO is one of the best options that you can have. And I still do not understand why dev use sealed for classes that are created to made life easier but because of this sealed they close a way to truly use and customize behaviours of the map - and I'm not thinking about behaviours that can be attached in XAML.


Than I saw, that you already are doing what I wanted to do -Zoom Throttling; however without possibility to set it. Your default settings 200 milliseconds which are not working for the users that use our map, usually they spend 450~550 milliseconds on zooming in and out. And because of that maps is generating X REST queries from which only last one is used, however the other ones still are executing and are downloading results - which is not good for bandwidth usage.

Take a look at Google/Bing maps and see how zooming in and out is reacting. They are doing some unnecessary request, but not as much as ArcGIS Map control.

If you do not want users to inherit from your map, then at least provide possibility to do some tweaking instead of hiding features in internal sealed classes.
0 Kudos
JakubGutkowski
Emerging Contributor
Here you can find sample solution that demonstrate that MouseWheel event declared from XAML is not fired.

I've done test on 4 computers now:

  1. DevTools: VS 2010 Prof and Utlimate, with SL 4 Tools, Resharper 5/5.1, SL Toolkit (the newest) plus ArcGIS SDK for SL/WPF 2.0 - no other plugins

  2. Operating systems: Windows 7 64 bit, Windows XP 32 bit, Windows 2008 64bit (one virtual, one physical)

  3. Browsers: IE 8, Chrome, FF


and I'm still not able to see my message box:

private void MyMap_MouseWheel(object sender, MouseWheelEventArgs e)
{
        MessageBox.Show("mouse wheel in action");
}
0 Kudos
EugeneChuguy
Emerging Contributor
Does the problem solved? I have to subscript on MouseWheel event to, but it does not work for me
0 Kudos
JenniferNery
Esri Regular Contributor
This is by design, MouseWheel event is already marked handled by our MouseWheelHelper.
0 Kudos