3 Answers, 1 is accepted
You can use following code for this purpose:
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
InitializeComponent();
this
.radMap.MouseMove +=
new
MouseEventHandler(radMap_MouseMove);
}
private
void
radMap_MouseMove(
object
sender, MouseEventArgs e)
{
Location mouse = Location.GetCoordinates(
this
.radMap, e.GetPosition(
this
.radMap));
this
.coordinates.Text = mouse.ToString();
}
}
Sincerely yours,
Andrey Murzov
the Telerik team

I have another similar question. When adding items to the information layer (for example an ellipse) I noticed that the item is being added at the specified coordinates using it's top-left corner as the starting point. Is it possible to add items centered? In other words, I want the location chosen to designate the center of the ellipse.
Edit:
Thanks to this post http://www.telerik.com/community/forums/wpf/map/how-to-position-images-without-using-pinpoint.aspx , I was able to solve the above issue by using the VerticalAlignment and HorizontalAlignment properties and setting them to "Center".
The RadMap supports two ways to align FrameworkElement around the location.
The first one is using of VerticalAlignment and HorizontalAlignment properties.
HorizontalAlignment.Right (default) - the element is located to the right of the location.
HorizontalAlignment.Left - the element is shifted to the left of the location.
HorizontalAlignment.Center - the element is centered over the location.
VerticalAlignment.Bottom (default) - the element is located at the bottom of the location.
VerticalAlignment.Top - the element is shifted to the top of the location.
VerticalAlignment.Center - the element is centered over the location.
The second approach is using of the HotSpot definition. The HotSpot can be defined for the whole element as well as for any children inside. Hot spot is a position inside or outside the element which is bound to the geographical location is specified for the framework element. You can see how it can be implemented in our RadMap demo:
http://demos.telerik.com/silverlight/#Map/HotSpot
For more information please see the Using of the Hot Spot documentation topic:
http://www.telerik.com/help/wpf/map-item-hot-spot.html
If you use the MapEllipse shape, then you can use the following sample method to get centered ellipse:
private
MapEllipse CreateMapEllipseByCenter(Location center,
double
width,
double
height)
{
MapEllipse ellipse =
new
MapEllipse();
ellipse.Width = width;
ellipse.Height = height;
Size degreeSize = radMap.GetLatitudeLongitudeSize(center, width, height);
Location location =
new
Location(center.Latitude + degreeSize.Height / 2d,
center.Longitude - degreeSize.Width / 2d);
MapLayer.SetLocation(ellipse, location);
return
ellipse;
}
Sincerely yours,
Andrey Murzov
the Telerik team