ChangeBasemap() public méthode

public ChangeBasemap ( string basemap ) : void
basemap string
Résultat void
        private void ShowBasemapList()
        {
            // Create a new Alert Controller
            UIAlertController basemapsActionSheet = UIAlertController.Create("Basemaps", "Choose a basemap", UIAlertControllerStyle.ActionSheet);

            // Create an action that will apply a selected basemap
            var changeBasemapAction = new Action <UIAlertAction>((axun) => { _mapViewModel.ChangeBasemap(axun.Title); });

            // Add items to the action sheet to apply each basemap type
            foreach (var bm in _mapViewModel.BasemapChoices)
            {
                UIAlertAction actionItem = UIAlertAction.Create(bm, UIAlertActionStyle.Default, changeBasemapAction);
                basemapsActionSheet.AddAction(actionItem);
            }

            // Required for iPad - You must specify a source for the Action Sheet since it is displayed as a popover
            UIPopoverPresentationController presentationPopover = basemapsActionSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Display the list of basemaps
            this.PresentViewController(basemapsActionSheet, true, null);
        }
Exemple #2
0
        // Click handler for basemap menu items
        private void OnBasemapsMenuItemClicked(object sender, PopupMenu.MenuItemClickEventArgs e)
        {
            // Get the title of the selected item
            var selectedBasemapType = e.Item.TitleCondensedFormatted.ToString();

            // Pass the selected basemap name to the view model ChangeBasemap method
            _mapViewModel.ChangeBasemap(selectedBasemapType);
        }
Exemple #3
0
        private void OnBasemapsClicked(object sender, ItemTappedEventArgs e)
        {
            // Get the text (basemap name) selected in the list box
            var basemapName = e.Item.ToString();

            // Pass the basemap name to the view model method to change the basemap
            _mapViewModel.ChangeBasemap(basemapName);
            // Hide the basemap list
            BasemapListBox.IsVisible = false;
        }