public MainPage() { var map = new Map( MapSpan.FromCenterAndRadius( new Position(37, -122), Distance.FromMiles(0.3))) { IsShowingUser = true, HeightRequest = 100, WidthRequest = 960, VerticalOptions = LayoutOptions.FillAndExpand }; var stack = new StackLayout { Spacing = 0 }; stack.Children.Add(map); Content = stack; InitializeComponent(); var slider = new Slider(1, 18, 1); slider.ValueChanged += (sender, e) => { var zoomLevel = e.NewValue; // between 1 and 18 var latlongdegrees = 360 / (Math.Pow(2, zoomLevel)); map.MoveToRegion(new MapSpan(map.VisibleRegion.Center, latlongdegrees, latlongdegrees)); }; var position = new Position(37, -122); // Latitude, Longitude var pin = new Pin { Type = PinType.Place, Position = position, Label = "custom pin", Address = "custom detail info" }; map.Pins.Add(pin); }
public BienPage(BienImmo bien) { InitializeComponent(); this.bien = bien; favorites = new FavoriteCheck { Checked = bien.isFavorite, HorizontalOptions = LayoutOptions.EndAndExpand, }; favorites.Clicked += OnFavClicked; button = new Button { Text = "3D Model" }; button.Clicked += On3DModelClicked; map = new Map { HeightRequest = 300, WidthRequest = 960, VerticalOptions = LayoutOptions.FillAndExpand }; map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(bien.CoordLat, bien.CoordLong), Distance.FromMiles(1.2))); var pin = new Pin { Type = PinType.Place, Position = new Position(bien.CoordLat, bien.CoordLong), Label = bien.Titre, Address = bien.Soustitre }; map.Pins.Add(pin); StackLayout stackLayout = new StackLayout { Spacing = 0, Padding = 10, Children = { new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = bien.Titre, FontAttributes = FontAttributes.Bold }, favorites } }, new Label { Text = bien.Soustitre, FontSize = 11, Margin = new Thickness(0, 0, 0, 15) }, new Image { Source = bien.Photo, HeightRequest = 150, Margin = new Thickness(0, 0, 0, 15) }, new Label { Text = "Description", FontAttributes = FontAttributes.Bold }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "" + bien.Surface, FontSize = 11 }, new Label { Text = "m²", FontSize = 11 } } }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "" + bien.Prix, FontSize = 11 }, new Label { Text = "€", FontSize = 11, Margin = new Thickness(0, 0, 0, 15) } } }, new Label { Text = bien.Description, Margin = new Thickness(0, 0, 0, 15) }, new Label { Text = "Address", FontAttributes = FontAttributes.Bold, Margin = new Thickness(0, 0, 0, 15) }, new Label { Text = bien.Adresse }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = bien.Ville }, new Label { Text = bien.Cp, Margin = new Thickness(0, 0, 0, 15) } } }, new Label { Text = "Contact", FontAttributes = FontAttributes.Bold, Margin = new Thickness(0, 0, 0, 15) }, new Label { Text = bien.Telephone }, new Label { Text = bien.Email, Margin = new Thickness(0, 0, 0, 15) }, new Label { Text = "Map", FontAttributes = FontAttributes.Bold, Margin = new Thickness(0, 0, 0, 15) }, map, button } }; Content = new ScrollView { Content = stackLayout }; }
public void setMapRegion(Xamarin.Forms.Maps.Position position) { map.MoveToRegion(MapSpan.FromCenterAndRadius(new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude), Distance.FromMiles(2))); }