Select to view content in your preferred language

Suggestions for MouseDown and Map Pan conflict

910
3
09-07-2010 01:47 PM
StephenSporik
Deactivated User
Hi,

I have a polygon Feature Layer that covers continuously most my map.  I have set an event on the MouseLeftButtonDown so the user can open a custom Identify window related to the feature, in addition to the map zooming to the boundary extent of that feature.

This works great for showing detailed information and including some silverlight charting using the attribute data.  I also have several other layers that use map tips and query tools so I wanted to use this approach to distinguish these polygons from the other feature layers.

The only problem has been that the pan functionality of the silverlight api becomes interrupted by the click event of the feature layer.  And since the feature layer covers almost everything it is a constant issue for the user. 

Has anyone come across this issue and thought of a work around aside from creating a custom navigation tool and putting it in a toolbar?  I am using one of the ESRI basic templates and I don't want to spend too much time altering the arrangement.

Thanks.
0 Kudos
3 Replies
dotMorten_esri
Esri Notable Contributor
Have you thought about using the Map.Click event instead to trigger the window? Click wont be raised if the user did a pan.
0 Kudos
MarioVernari
Emerging Contributor
Hi there.
I had the same problem, but I've found a workaround.
Bear in mind I'm working on a WPF app, but I guess should be working for SL too.

My actual deal is to create an ElementLayer where the user can drag, resize and interact with objects. I must intercept most of the input events and some other stuffs too.

NOTE: This as follows is a ROUGH way to do it and -personally- I'd prefer 1000 times that ESRI staff would give a better interface. In the meantime I must use anyway.
1) in the code, trigger the LayoutUpdated event, to "ensure" that the Map control has been built totally (tiled layer and an element layer);
2) declare a Canvas var somewhere in the app;
3) within the LayoutUpdate event handler scan the visual tree (VisualTreeHelper) from the Map control toward the descendant, until you find a Canvas (few steps);
4) set the reference of the found Canvas to the declared var and SET the background of the Canvas itself as transparent;
5) further subscribe any event you need for the Canvas (you should also UN-subscribe somewhere);
6) within the subscribed event handlers, use the Handled property of the arguments to TRUE if you code should catch the event, otherwise the event will walk-up the visual tree to the Map control manager for the standard handlers.

My suggestion to the ESRI staff is to offer something similar to the developer, without forcing a tree-inspection. That works, but it is the worst way to solve a problem.

Cheers
0 Kudos
StephenSporik
Deactivated User
Thank you,

The Map.Click event does not conflict with the map pan functionality.
0 Kudos