<Grid Width="355" Height="65" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,50,15,0" > <Rectangle Stroke="Gray" RadiusX="10" RadiusY="10" Fill="#77919191" Margin="0,0,0,6" > <Rectangle.Effect> <DropShadowEffect/> </Rectangle.Effect> </Rectangle> <Rectangle Fill="#FFFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" /> <StackPanel Canvas.Left="20" Canvas.Top="14" Margin="20,14,10,0"> <TextBlock x:Name="MapCoordsTextBlock" HorizontalAlignment="Left" VerticalAlignment="Center" Text="Map Coords: " TextWrapping="Wrap" FontWeight="Bold" /> </StackPanel> </Grid>
this.AssociatedObject.MouseMove +=new MouseEventHandler(AssociatedObject_MouseMove);
private void AssociatedObject_MouseMove(object sender, System.Windows.Input.MouseEventArgs args) { if (this.AssociatedObject != null) { System.Windows.Point screenPoint = args.GetPosition(MapApplication.Current.Map); ESRI.ArcGIS.Client.Geometry.MapPoint mapPoint = MapApplication.Current.Map.ScreenToMap(screenPoint); TextBlock tb = MapApplication.Current.FindObjectInLayout("MapCoordsTextBlock") as TextBlock; tb.Text = string.Format("Map Coords: X = {0}, Y = {1}", Math.Round(mapPoint.X, 4), Math.Round(mapPoint.Y, 4)); } }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.