Example #1
0
        public MapBase()
        {
            SetParentMap();

            TileLayers = new TileLayerCollection();
            Initialize();

            Loaded += OnLoaded;
        }
Example #2
0
        private void TileLayerPropertyChanged(TileLayer tileLayer)
        {
            if (tileLayer != null)
            {
                if (TileLayers == null)
                {
                    TileLayers = new TileLayerCollection();
                }

                if (TileLayers.Count == 0)
                {
                    TileLayers.Add(tileLayer);
                }
                else if (TileLayers[0] != tileLayer)
                {
                    TileLayers[0] = tileLayer;
                }
            }

            if (tileLayer != null && tileLayer.Background != null)
            {
                if (storedBackground == null)
                {
                    storedBackground = Background;
                }

                Background = tileLayer.Background;
            }
            else if (storedBackground != null)
            {
                Background       = storedBackground;
                storedBackground = null;
            }

            if (tileLayer != null && tileLayer.Foreground != null)
            {
                if (storedForeground == null)
                {
                    storedForeground = Foreground;
                }

                Foreground = tileLayer.Foreground;
            }
            else if (storedForeground != null)
            {
                Foreground       = storedForeground;
                storedForeground = null;
            }
        }
Example #3
0
        private void TileLayersPropertyChanged(TileLayerCollection oldTileLayers, TileLayerCollection newTileLayers)
        {
            tileContainer.ClearTileLayers();

            if (oldTileLayers != null)
            {
                oldTileLayers.CollectionChanged -= TileLayerCollectionChanged;
            }

            if (newTileLayers != null)
            {
                newTileLayers.CollectionChanged += TileLayerCollectionChanged;
                tileContainer.AddTileLayers(0, newTileLayers);
            }

            UpdateTileLayer();
        }