Share via


TileSource Class

 

Retrieves the URI for a tile based on its zoom level and tile position.

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

Inheritance Hierarchy

System.Object
  Microsoft.Maps.MapControl.WPF.TileSource

Syntax

public class TileSource : INotifyPropertyChanged
public ref class TileSource : INotifyPropertyChanged
type TileSource = 
    class
        interface INotifyPropertyChanged
    end
Public Class TileSource
    Implements INotifyPropertyChanged

Constructors

Name Description
System_CAPS_pubmethod TileSource()

Initializes a new instance of the TileSource class.

System_CAPS_pubmethod TileSource(String)

Initializes a new instance of the TileSource class.

Properties

Name Description
System_CAPS_pubproperty UriFormat

Gets or sets the format used to create the URI.

System_CAPS_pubproperty Visibility

Gets or sets the visibility of the tile.

Methods

Name Description
System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetSubdomain(QuadKey)

Retrieves the sub-domain for the tile identified by the specified quad key.

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod GetUri(Int32, Int32, Int32)

Retrieves the URI for the tile specified by the given x, y coordinates and zoom level.

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_protmethod OnPropertyChanged(String)

Enables the ability to provide custom handling when a property of the tile source changes.

System_CAPS_pubmethod SetSubdomains(String[][])

Sets a matrix that represents sub-domains.

System_CAPS_pubmethod ToString()

(Inherited from Object.)

Fields

Name Description
System_CAPS_pubfieldSystem_CAPS_static QuadKeyUriFragment

Specifies the piece of the URI that is the quad key.

System_CAPS_pubfieldSystem_CAPS_static SubdomainUriFragment

Specifies the piece of the URI that is the sub-domain.

System_CAPS_pubfieldSystem_CAPS_static UriSchemeUriFragment

Specifies the pieces of the URI that specify the URI scheme.

Events

Name Description
System_CAPS_pubevent PropertyChanged

Occurs when a property of the tile source changes.

Examples

This sample code uses the TileSource class to create a map tile layer and adds the map layer to the map. For more information and the complete sample, see Adding Tile Overlays to the Map.

private void AddTileOverlay()
{

    // 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 AddTileOverlay()

    ' 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

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Microsoft.Maps.MapControl.WPF Namespace

Return to top