I'm using the BasemapGallery from Esri.ArcGISRuntime.Toolkit.Maui. There's an AvailableBasemaps property. I'm trying to figure out a way to limit the number of basemaps added when the control is loaded with all of the basemaps. If anyone has some sample code for this, that would be greatly helpful. I'm able to remove basemaps using a button after they are loaded, but this need it to occur before all the basemaps load (better performance 😁). Thanks.
Solved! Go to Solution.
For now, it looks like loading the default collection of ArcGIS Developer basemaps is unfortunately hard-coded in the Toolkit as currently released on NuGet.org. But the good news is, it's open source and you can easily resolve this yourself and rebuild (until we can triage and resolve appropriately).
You just need to remove the call to LoadFromDefaultPortal() on this line:
Because that call ultimately calls PopulateFromDefaultList which creates a default ArcGISPortal instance (arcgis.com) and calls GetDeveloperBasemapsAsync():
For now, it looks like loading the default collection of ArcGIS Developer basemaps is unfortunately hard-coded in the Toolkit as currently released on NuGet.org. But the good news is, it's open source and you can easily resolve this yourself and rebuild (until we can triage and resolve appropriately).
You just need to remove the call to LoadFromDefaultPortal() on this line:
Because that call ultimately calls PopulateFromDefaultList which creates a default ArcGISPortal instance (arcgis.com) and calls GetDeveloperBasemapsAsync():
Thanks for the info on this. I ended up writing my own .NET Maui Control (ContentView) and adding the basemaps I needed from a configuration file. I just needed the ItemId and used ESRI.ArcGISRuntime.Portal.PortalItem to get the item. Then, once I instantiated the ESRI.ArcGISRuntime.Mapping.Basemap, I could get all of the relevant information (Name, Thumbnail, etc).