Forum Xamarin.Forms

Pass pins value to next page in xamarin forms

Hello all.
I am using map in my app.i add some pins in the map . When i click on pin it display some info.Now i want to pass the values/info of pins to next page after clicking on pin tooltip. here is what i am trying.

Pin pins;
        protected async override void OnAppearing()
            // workerListVM.DisplayMap();
            var employeesDetail = await workerListVM.getdetail();
            foreach (var employees in employeesDetail)
                    map1.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(employees.Latitude, employees.Longitude),Distance.FromMiles(.5)));
                    var position = new Position(employees.Latitude, employees.Longitude);

                     pins = new Pin()
                        Type = PinType.Place,
                        Position = position,
                        Label = employees.UserName,
                        Address = employees.City
                    pins.Clicked += Pins_Clicked;
                catch (NullReferenceException) { }
                catch (Exception) { }

        private void Pins_Clicked(object sender, EventArgs e)
            DisplayAlert($"{pins.Label}", $"{pins.Address}", "Ok");

but its not working.

Best Answer


  • AsurAsur USMember ✭✭✭

    Default behavior is pins.Click fires when you click the label that pops up when clicking the pin . So did you try clicking the marker/label as well ?

  • ProgrammerProgrammer Member ✭✭

    when i click the pin,a marker/label pops up and then when i click on marker/label it display alert .but problem is it always display the same values for each pin click.but i want to display only the values of the pin i click

  • ericjkoericjko Member
    edited February 2020

    @LandLu How to send that information to next page?

    update: nevermind I figured it out :)

Sign In or Register to comment.