Fix for #2050 [DOC] Update Sample Application to demonstrate correct way to initialize Maps in MauiProgram.cs to support Maps on all platforms. #2325
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
Demonstrate the correct way to incorporate .Net Maui Maps for Windows into a multiplatform application.
The 2.0.1 Release of the Community Toolkit Maps component introduced a change that requires the #ifdef Windows directive when compiling a multiple platform application with Maps.
This can cause confusion for people trying to incorporate Maps into the application due to the fact that since Maui 8.0.10 now throws an exception on Windows when using the standard Maps component.
No prior tests for this sample code.
This code is a sample.
Linked Issues
[DOC] Update Sample Application to demonstrate correct way to initialize Maps in MauiProgram.cs #2050
PR Checklist
approved
(bug) orChampioned
(feature/proposal)main
at time of PRAdditional information
Modified ReadMe.txt to illustrate proper way instantiate .Net Maui Maps when using CommunityToolk.Maui.Maps
Tested on Android API 35 (requires Google API Key) - New Requirement
Tested on Windows 11
Did not test on iOS or Mac Catalyst