Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <maps:Map x:Name="Map">
  2. ...
  3. </maps:Map>
  4.  
  5. var position = new Position(37.79762, -122.40181);
  6. Map.MoveToRegion(new MapSpan(position, 0.01, 0.01));
  7. Map.Pins.Add(new Pin
  8. {
  9. Label = "Xamarin",
  10. Position = position
  11. });
  12.  
  13. ((ViewModels.YourViewModel)BindingContext).PropertyChanged += yourPropertyChanged;
  14.  
  15. private void yourPropertyChanged(object sender, PropertyChangedEventArgs e)
  16. {
  17. if(e.PropertyName == "YourPropertyName")
  18. {
  19. var position = new Position(37.79762, -122.40181);
  20. Map.MoveToRegion(new MapSpan(position, 0.01, 0.01));
  21. Map.Pins.Add(new Pin
  22. {
  23. Label = "Xamarin",
  24. Position = position
  25. });
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement