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.
I am trying to do the same thing as wmlanza2, show a popup while hovering over a map element and display some of the data from SQL and have not been able to find any documentation or examples. Can someone point me in the right direction? Thanks.
you can set MapElement properties using the DataMapping, and access them in that MapElement event, so I think you can achieve this using the same technique discussed earlier.
more info on DataMapping: http://help.infragistics.com/Help/NetAdvantage/DV/2009.2/CLR3.5/html/SL_DV_xamWebMap_About_Data_Mapping.html
note that you can assign DataMappings for arbitrarily named properties, such as:
DataMapping="Foom=MY_COLUMN"
in this case, you could access the Foom property using e.Element.GetProperty("Foom");