11

I have a windows phone runtime app where I display a push pin on a map using xaml.

<Maps:MapControl 
    Center="{Binding GeoPoint, Mode=OneWay}"
    Name="mapControl" 
    Height="270"
    MapServiceToken="token"
    ZoomLevel="1">
       <Ellipse
          Fill="Red" 
          Height="20" 
          Width="20" 
          Maps:MapControl.Location="{Binding GeoPoint, Mode=OneWay}"
          Maps:MapControl.NormalizedAnchorPoint="1, 0.5"/>
</Maps:MapControl>

When I drag the map there is some lag with the control trying to keep to the same position.

Any help would be appreciated.

Thanks,

sidy3d
  • 440
  • 2
  • 8
  • 22
  • While dealing with the same problem with the lag, I wonder whether you got "NormalizedAnchorPoint" working. Whatever I do, with or without binding, it always uses (0,0) :/ – sibbl Aug 31 '14 at 09:57
  • 1
    MapControl's API is HEAVILY bugged and I really discourage anyone to use it. This is one of the MANY discovered malfunctions. In order to get NormalizedAnchorPoint working properly, you have to bind that attached property to the Point property in your DataContext - awfull workaround but it works. I belive that assigning a value from the code-behibd will also do the trick. Unfortunatelly I havent been able to fix the lag for the map elements. If you will find anything that can help the flickering, please do share! – Malutek Sep 17 '14 at 00:14
  • afaik normalizedanchorpoint *only* allows new Point(x,y) with values x & y being either 0 or 1. – koenmetsu Oct 30 '14 at 13:26

1 Answers1

0

If you're doing some work on CenterChanged or ZoomLevelChanged, then don't. I was calculating some stuff in this events and it was showstopper. You should get much smoother experience for users with throttling (using reactive extensions) like this:

Observable.FromEventPattern<object>(this.MyMap, "CenterChanged").Throttle(TimeSpan.FromSeconds(.25)).ObserveOnDispatcher().Subscribe(e => UpdateMap());
Observable.FromEventPattern<object>(this.MyMap, "ZoomLevelChanged").Throttle(TimeSpan.FromSeconds(.25)).ObserveOnDispatcher().Subscribe(e => UpdateMap());
kober
  • 832
  • 7
  • 13