O'Reilly logo

Learning ArcGIS Runtime SDK for .NET by Ron Vincent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Overlays

In earlier chapters, we discussed overlays in a limited manner. But now, it's time to go a little deeper into the subject. Overlays allow you to add .NET FrameworkElement to a collection called OverlayItemsCollection. For example, the following code can be used to add TextBlock over San Francisco:

var tb = new TextBlock();
tb.Foreground = new SolidColorBrush(Colors.Red);
tb.FontWeight = FontWeights.Bold;
tb.Background = new SolidColorBrush(Colors.White);
tb.Height = 20;
tb.Text = "San Francisco";

var geoPoint = new Esri.ArcGISRuntime.Geometry.MapPoint(-122.44, 
    37.8, Esri.ArcGISRuntime.Geometry.SpatialReferences.Wgs84);

this.mapView.Overlays.Items.Add(tb);
    Esri.ArcGISRuntime.Controls.MapView.SetViewOverlayAnchor(tb, 
    geoPoint);

See here: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required