0

I've bound the center of my MapControl, but the map doesn't update when I'm moving.

<maps:MapControl BusinessLandmarksVisible="False"
                 LandmarksVisible="False"
                 ColorScheme="Light"
                 DesiredPitch="50"
                 PedestrianFeaturesVisible="False"
                 TrafficFlowVisible="False"
                 TransitFeaturesVisible="False"
                 ZoomLevel="20"
                 RelativePanel.AlignTopWithPanel="True"
                 RelativePanel.AlignBottomWithPanel="True"
                 RelativePanel.AlignLeftWithPanel="True"
                 RelativePanel.AlignRightWithPanel="True"
                 Center="{Binding CurrentGeoposition.Coordinate.Point, Mode=TwoWay}"
                 MapServiceToken="{Binding MapServiceToken, Mode=OneTime}"
                 x:Name="MapControl"/>

The only solution was to make it a two-way binding, but since it's bound to a Geoposition, I'm flooded by errors like this:

Error: Cannot save value from target back to source. BindingExpression: Path='CurrentGeoposition.Coordinate.Point' DataItem='MyNamespace.ViewModels.GameManagerViewModel'; target element is 'Windows.UI.Xaml.Controls.Maps.MapControl' (Name='MapControl'); target property is 'Center' (type 'Geopoint').

Is there a way to make this work without all the errors but without code-behind?

StepTNT
  • 3,867
  • 7
  • 41
  • 82

1 Answers1

0

Try this in your XAML:

Center="{Binding MapCenter, Mode=TwoWay}"

And this in your viewModel:

public Geopoint MapCenter {
    get;
    set; }

If that doesn't help, can you paste your viewModel as well as your XAML?