private void OnOffsetChanged(object sender, EventArgs e) { this.BeginUpdate(); MapOffset offset = (MapOffset)sender; offset.Property.SetValue(_translate, offset.Offset, null); this.EndUpdate(); }
public MapCanvas() { _mapControlFactory = MapControlFactoryToUse; if (_mapControlFactory != null) { _offsetX = _mapControlFactory.GetMapOffset(_translate.GetType().GetProperty("X"), this.OnOffsetChanged); _offsetY = _mapControlFactory.GetMapOffset(_translate.GetType().GetProperty("Y"), this.OnOffsetChanged); _tilePanel = _mapControlFactory.TilePanel; _tilePanel.RenderTransform = _translate; } this.Background = Brushes.Transparent; // Register all mouse clicks this.Children.Add(_cache); if (_mapControlFactory != null) { this.Children.Add(_tilePanel); } this.ClipToBounds = true; this.Focusable = true; this.FocusVisualStyle = null; this.SnapsToDevicePixels = true; }