I am trying to get a silverlight popup to display near the mouse when I hover over a map element.
Is there a way of getting the mouse position from the elements symbol position?
this is not exposed as a feature of the map; however, you can use the RenderTransform of the Map Viewport's RootCanvas to translate the coordinate.
private void XamWebMap_ElementHover(object sender, MapElementHoverEventArgs e) { XamWebMap theMap = (XamWebMap)sender; Point pos = e.Element.ActualSymbolOrigin; pos = theMap.Viewport.RootCanvas.RenderTransform.Transform(pos); Popup pop = new Popup(); pop.Child = new TextBlock() { Text = "hello" }; pop.HorizontalOffset = pos.X; pop.VerticalOffset = pos.Y; pop.IsOpen = true; }
alternatively, you could just use the MouseMove event, and avoid referencing any MapElement.
If use MouseMove event, will it slow down the silverlight page and have bad performance.
that is the only way to get the mouse position for now, since the ElementHover EventArgs do not contain that information.
you can enter a feature request here: http://devcenter.infragistics.com/protected/requestfeature.aspx