Share via


MapTileLayer Constructor ()

 

Initializes a new instance of the MapTileLayer class.

Namespace:   Microsoft.Maps.MapControl.WPF
Assembly:  Microsoft.Maps.MapControl.WPF (in Microsoft.Maps.MapControl.WPF.dll)

Syntax

public MapTileLayer()
public:
MapTileLayer()
new : unit -> MapTileLayer
Public Sub New

Remarks

The following example

Examples

The following example shows how to add a map tile layer to a map. For the complete example, see Adding Tile Overlays to the Map.

private void AddTerrainTileOverlay()
{

    // Create a new map layer to add the tile overlay to.
    tileLayer = new MapTileLayer();

    // The source of the overlay.
    TileSource tileSource = new TileSource();
    tileSource.UriFormat = "{UriScheme}://ecn.t0.tiles.virtualearth.net/tiles/r{quadkey}.jpeg?g=129&mkt=en-us&shading=hill&stl=H";

    // Add the tile overlay to the map layer
    tileLayer.TileSource=tileSource;

    // Add the map layer to the map
    if (!MapTileOverlay.Children.Contains(tileLayer))
    {
        MapTileOverlay.Children.Add(tileLayer);
    }
    tileLayer.Opacity = tileOpacity;
}
Private Sub AddTerrainTileOverlay()

    ' Creates a new map layer to add the tile overlay to.
    tileLayer = New MapTileLayer()

    ' The source of the overlay.
    Dim tileSource As New TileSource()
    tileSource.UriFormat = "{UriScheme}://ecn.t0.tiles.virtualearth.net/tiles/r{quadkey}.jpeg?g=129&mkt=en-us&shading=hill&stl=H"

    ' Adds the tile overlay to the map layer
    tileLayer.TileSource = tileSource

    ' Adds the map layer to the map
    If Not MapTileOverlay.Children.Contains(tileLayer) Then
        MapTileOverlay.Children.Add(tileLayer)
    End If
    tileLayer.Opacity = tileOpacity
End Sub

See Also

MapTileLayer Class
Microsoft.Maps.MapControl.WPF Namespace

Return to top