Select to view content in your preferred language

MapTip - Override Event

602
5
08-18-2010 02:30 PM
lyndamccallum
Deactivated User
I'm looking to change the behaviour of the silverlight maptip. I want the maptip to stay up until a button on the maptip is clicked. I figure I can make the maptiphidedelay really large to keep the map tip up but how can I overwrite the mouseleave method? Can a button click even interact with the visibility of the maptip?
0 Kudos
5 Replies
MartenLiebster
Deactivated User
I'm looking to change the behaviour of the silverlight maptip. I want the maptip to stay up until a button on the maptip is clicked. I figure I can make the maptiphidedelay really large to keep the map tip up but how can I overwrite the mouseleave method? Can a button click even interact with the visibility of the maptip?


I don't think you're able to do this with a map tip, due to the nature of a map tip.

What you can do is make your own custom MarkerSymbol. We are doing this with an ellipse to mark the point, with a canvas that is hidden until you mouse over the point. This canvas has text info bound to the attribute collection and has buttons with events handled in the codebehind.
0 Kudos
dotMorten_esri
Esri Notable Contributor
Correct. This is not the behavior of the maptip.
You can also use the MouseLeftButtonDown event on the graphic to pop up a UserControl on top of the map. Use the screencoordinate in the mouse event to determine where to put the usercontrol.
0 Kudos
MartenLiebster
Deactivated User
Correct. This is not the behavior of the maptip.
You can also use the MouseLeftButtonDown event on the graphic to pop up a UserControl on top of the map. Use the screencoordinate in the mouse event to determine where to put the usercontrol.


Regarding efficiency of the two approaches ... we have a section of our app where there are about 1500 to 2000 points.

Is it more efficient, or more accurately more performant, to have a custom MarkerSymbol used 1500 times or to have a "light weight" marker (SimpleMarkerSymbol for example) with an external UserControl being generated and displayed on demand by mouse overs?
0 Kudos
dotMorten_esri
Esri Notable Contributor
Light weight marker + one usercontrol will be way more efficient. If you have a lot of data you always want to keep your symbol templates as simple as possible.
Note: I wouldn't generate a new usercontrol instance on each mouse over. I would just have one present on top of the map, and toggle the visibility and move it to the location of the new marker on mouse enter. Set the DataContext of the control to the graphic to update the contents in the custom maptip, just like "normal' maptip works.
0 Kudos
MartenLiebster
Deactivated User
Light weight marker + one usercontrol will be way more efficient. If you have a lot of data you always want to keep your symbol templates as simple as possible.
Note: I wouldn't generate a new usercontrol instance on each mouse over. I would just have one present on top of the map, and toggle the visibility and move it to the location of the new marker on mouse enter. Set the DataContext of the control to the graphic to update the contents in the custom maptip, just like "normal' maptip works.


Thanks for the response.

We'll give it a try. Our initial effort, with the heavy symbols, really became sluggish with that many items. We sped it up using the FlareCluster tremendously, but it gives a very different appearance.

Thanks again.
0 Kudos