Map Your Apps: Listing 1.

Code that places a marker dot on a map.

.private void PlaceDot(Location locati
on, Color color)
  Ellipse dot = new Ellipse();
  dot.Fill = new SolidColorBrush(color);
  double radius = 12.0;
  dot.Width = radius * 2;
  dot.Height = radius * 2;
  ToolTip tt = new ToolTip();
  tt.Content = "Location = " + location;
  dot.ToolTip = tt;
  Point p0 = myMap.LocationToViewportPoint(location);
  Point p1 = new Point(p0.X - radius, p0.Y - radius);
  Location loc = myMap.ViewportPointToLocation(p1);
  MapLayer.SetPosition(dot, loc);

About the Author

Dr. James McCaffrey works for Microsoft Research in Redmond, Wash. He has worked on several Microsoft products including Azure and Bing. James can be reached at [email protected].

comments powered by Disqus


  • New TypeScript 4.2 Tweaks Include Project Explainer

    Microsoft shipped TypeScript 4.2 -- the regular quarterly update to the open source programming language that improves JavaScript with static types -- with a host of tweaks including a way to explain why files are included in a project.

  • What's Top-Paying .NET Skill, In-Demand Language?

    New tech reports reveal the top-paying .NET skills and most in-demand programming languages in the Microsoft-centric developer landscape.

  • Microsoft's Distributed Application Runtime (Dapr) Debuts for Microservices

    Dapr is now production ready in version 1.0, easing microservices development on-premises, on the edge or in the cloud by abstracting away distributed computing hassles.

  • What's New in EF Core 6.0 Preview 1

    The Entity Framework Core 6 dev team shipped Preview 1 this week, headed toward a debut with the larger, unifying .NET 6 umbrella platform in November.

Upcoming Events