diff --git a/MapControl/Shared/MapTileLayerBase.cs b/MapControl/Shared/MapTileLayerBase.cs index fa3f19a9..4302c47f 100644 --- a/MapControl/Shared/MapTileLayerBase.cs +++ b/MapControl/Shared/MapTileLayerBase.cs @@ -102,7 +102,7 @@ namespace MapControl /// /// Maximum number of background tile levels. Default value is 8. - /// Is only effective in a MapTileLayer that is the MapLayer of its ParentMap. + /// Only effective in a MapTileLayer or WmtsTileLayer that is the MapLayer of its ParentMap. /// public int MaxBackgroundLevels { diff --git a/MapControl/Shared/WmtsTileLayer.cs b/MapControl/Shared/WmtsTileLayer.cs index c5db770c..8391e797 100644 --- a/MapControl/Shared/WmtsTileLayer.cs +++ b/MapControl/Shared/WmtsTileLayer.cs @@ -125,6 +125,10 @@ namespace MapControl { currentMatrixes = currentMatrixes.Skip(currentMatrixes.Count - 1).ToList(); // last element only } + else if (currentMatrixes.Count > MaxBackgroundLevels + 1) + { + currentMatrixes = currentMatrixes.Skip(currentMatrixes.Count - MaxBackgroundLevels - 1).ToList(); + } var currentLayers = Children.Cast() .Where(layer => currentMatrixes.Contains(layer.TileMatrix))