Show Mouse Coordinates
This sample demonstrates how mouse move events on the Map are handled to return the mouse cursor location over the map. The location is displayed in pixels and map units.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.LocalMouseCoords" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:esri="http://schemas.esri.com/arcgis/client/2009" xmlns:esriGeometry="clr-namespace:ESRI.ArcGIS.Client.Geometry;assembly=ESRI.ArcGIS.Client"> <Grid x:Name="LayoutRoot" Background="White"> <Grid.Resources> <LinearGradientBrush x:Key="PanelGradient" EndPoint="0.5,1" StartPoint="0.5,0"> <LinearGradientBrush.RelativeTransform> <TransformGroup> <ScaleTransform CenterY="0.5" CenterX="0.5"/> <SkewTransform CenterY="0.5" CenterX="0.5"/> <RotateTransform Angle="176" CenterY="0.5" CenterX="0.5"/> <TranslateTransform/> </TransformGroup> </LinearGradientBrush.RelativeTransform> <GradientStop Color="#FF145787" Offset="0.16"/> <GradientStop Color="#FF3D7FAC" Offset="0.502"/> <GradientStop Color="#FF88C5EF" Offset="0.984"/> </LinearGradientBrush> </Grid.Resources> <esri:Map x:Name="MyMap" MouseMove="MyMap_MouseMove" WrapAround="True" Extent="-15000000,2000000,-7000000,8000000" Background="#FFE3E3E3" MinimumResolution="2445.98490512499"> <esri:ArcGISLocalTiledLayer ID="BaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/> </esri:Map> <Grid Width="355" Height="60" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,15,0" > <Rectangle RadiusX="10" RadiusY="10" Fill="#22000000" Margin="0,4,0,0" /> <Rectangle Stroke="Gray" RadiusX="10" RadiusY="10" Fill="{StaticResource PanelGradient}" /> <Rectangle Fill="#FFFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="6" /> <StackPanel Canvas.Left="20" Canvas.Top="14" Margin="0,14,10,0" HorizontalAlignment="Right" Width="325"> <TextBlock x:Name="ScreenCoordsTextBlock" Foreground="Black" HorizontalAlignment="Left" VerticalAlignment="Center" Text="Screen Coords: " TextWrapping="Wrap" FontWeight="Bold" /> <TextBlock x:Name="MapCoordsTextBlock" Foreground="Black" HorizontalAlignment="Left" VerticalAlignment="Center" Text="Map Coords: " TextWrapping="Wrap" FontWeight="Bold" /> </StackPanel> </Grid> </Grid> </UserControl>
5/16/2014