private void OnBasemapsClicked(object sender, EventArgs e)
{
// Get the button that raised the click event (change basemap)
var mapsButton = sender as Button;
// Create a menu to show basemap choices
var mapsMenu = new PopupMenu(mapsButton.Context, mapsButton);
// Handle the menu item click event
mapsMenu.MenuItemClick += OnBasemapsMenuItemClicked;
// Create a menu option for each basemap type defined in the view model
foreach (var choice in _mapViewModel.BasemapChoices)
{
mapsMenu.Menu.Add(choice);
}
// Show menu in the view
mapsMenu.Show();
}