Method LocationToScreen
LocationToScreen(MapPoint)
Converts a location in map coordinates to a screen coordinate relative to the upper-left corner of the map.
Declaration
public Point LocationToScreen(MapPoint location)
Parameters
Type | Name | Description |
---|---|---|
MapPoint | location | A location defined within the spatial reference of the map view. |
Returns
Type | Description |
---|---|
Microsoft.Maui.Graphics.Point | Screen location in this map control's local display coordinate system |
Remarks
The screen location returned is relative to the upper left corner of the map control. If you need a location relative to another visual element, use the TransformToVisual method to create a transformation between the map and another visual element.
The screen coordinates are in device-independent pixels (DIP) relative to the upper-left corner at position 0,0. The screen coordinates returned may lie outside the current map view bounds. For example, if a map of the world is zoomed in to the extent of Africa, a map location within South America would result in a screen coordinate that is outside the screens bounds.
If the WrapAroundMode is enabled on the map view, this method returns the closest screen location matching the specified map location. If the map coordinate is in the visible area the method will return that screen coordinate, otherwise it will return the screen coordinate from the frame closest to the visible area.
To call this method, assign a map to the map view, ensure that it is loaded and the draw status is Completed.
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET | 200.0 - 200.6 |
.NET Windows | 200.0 - 200.6 |
.NET Android | 200.0 - 200.6 |
.NET iOS | 200.0 - 200.6 |