# Displaying Geographic Coordinates on Mouseover

This topic covers information about displaying geographical coordinates on mouseover in Maps for WPF.

## Content



In this topic, you will add code to your project that will return the geographical coordinates of the current mouse position. These geographical coordinates will then be written as a string to the **Text** property of a **TextBox** control.

To get the geographical coordinates of the current mouse position, complete the following steps:

1.  Add a **StackPanel**, a **TextBox** control, and a **Maps** control to your project.
2.  Set the **StackPanel**'s properties as follows:
    *   Locate the **Width** property and click its glyph to set the **Width** property to **Auto**.
    *   Locate the **Height** property and click its glyph to set the **Height** property to **Auto**.
3.  Set the **TextBox** control's **Name** property to "ShowCoordinates".
4.  Set the C1Maps control's properties as follows:
    *   Set the **Width** property to "350".
    *   Set the **Height** property to "250".
5.  Select the C1Maps control and then, in the **Properties** panel, click the **Events** button .
6.  In the **MouseMove** text box, enter "MouseMoveCoordinates" and press ENTER to add the **MouseMoveCoordinates** event handler to your project.
7.  Replace the code comment with the following code:
    
    ```csharp
    C1Maps map = sender as C1Maps;
    Point p = map.ScreenToGeographic(e.GetPosition(map));
    ShowCoordinates.Text = string.Format("{0:f6},{1:f6}", p.X, p.Y);
    ```
    
8.  Press **F5** to run the project. Once the project is loaded, run your cursor over the map and observe that geographical coordinates appear in the text box.![Image of maps control showing coordinates.](https://cdn.mescius.io/document-site-files/images/b2f10bde-b014-49ed-ba3f-2bf12981f263/images/coordinates_final.png)