Fabulous.MauiControls.Maps
10.0.2
See the version list below for details.
dotnet add package Fabulous.MauiControls.Maps --version 10.0.2
NuGet\Install-Package Fabulous.MauiControls.Maps -Version 10.0.2
<PackageReference Include="Fabulous.MauiControls.Maps" Version="10.0.2" />
<PackageVersion Include="Fabulous.MauiControls.Maps" Version="10.0.2" />
<PackageReference Include="Fabulous.MauiControls.Maps" />
paket add Fabulous.MauiControls.Maps --version 10.0.2
#r "nuget: Fabulous.MauiControls.Maps, 10.0.2"
#:package Fabulous.MauiControls.Maps@10.0.2
#addin nuget:?package=Fabulous.MauiControls.Maps&version=10.0.2
#tool nuget:?package=Fabulous.MauiControls.Maps&version=10.0.2
Maps for Fabulous.MauiControls
The Map control is a cross-platform view for displaying and annotating maps. You can find all the details about this control on the .NET MAUI Maps documentation.
How to use
Add the
Fabulous.MauiControls.Mapspackage to your project.Add
.UseFabulousMaps()to yourMauiProgramafter.UseFabulousApp().
open Fabulous.Maui.Maps
type MauiProgram =
static member CreateMauiApp() =
MauiApp
.CreateBuilder()
.UseFabulousApp(App.program)
.UseFabulousMaps()
(...)
.Build()
- Open Fabulous.Maui.Maps at the top of the file where you declare your Fabulous program (eg. Program.stateful).
open Fabulous.Maui.Maps
- Depending on which platform you're targeting, you might need to do some configuration before the map widget will work. See "Initialization and Configuration" down below.
Initialization and Configuration
The Map widget will be rendered by the native map controls of each platform depending on the device you're running on. Some of those platforms require that you make some configuration before being able to use the Map widget.
Please follow the .NET MAUI documentation to learn about the requirements: .NET MAUI Map Get Started
Usage
This package adds several widgets for you to use:
Map(region: MapSpan): Displays a map centered on the position specifiedMapWithPins(region: MapSpan) { MapPin; MapPin; ... }: Displays a map with some pins on it
To learn more about the capabilities of the Map and MapWithPins widgets, see .NET MAUI Map Control.
Map(MapSpan.FromCenterAndRadius(Position(47.640663, -122.1376177), Distance.FromMiles(250.)))
.hasZoomEnabled(true)
.hasScrollEnabled(true)
.mapType(MapType.Street)
.isShowingUser(true)
.isTrafficEnabled(true)
.onMapClicked (MapClicked)
let position = Position(36.9628066, -122.0194722)
let mapSpan = MapSpan(position, 0.01, 0.01)
(MapWithPins(mapSpan) {
MapPin(position)
.address("My Address1")
.label("I'm a marker1")
.pinType(PinType.Place)
.onMarkerClicked(MarkerClicked)
.onInfoWindowClicked (MarkerClicked)
MapPin(Position(36.9641949, -122.0177232))
.address("My Address2")
.label("I'm a marker1")
.pinType(PinType.Place)
.onMarkerClicked(MarkerClicked)
.onInfoWindowClicked (MarkerClicked)
})
It is also possible to draw shapes directly on the map using the .mapElements() { ... } modifier.
It supports several shapes: MapCircle, MapPolygon, MapPolyline.
Map(MapSpan.FromCenterAndRadius(Position(47.640663, -122.1376177), Distance.FromMiles(1.)))
.mapElements () {
// Draw a polygon on the map
MapPolygon(
[ Position(47.6458676, -122.1356007)
Position(47.6458097, -122.142789)
Position(47.6367593, -122.1428104)
Position(47.6368027, -122.1398707)
Position(47.6380172, -122.1376177)
Position(47.640663, -122.1352359)
Position(47.6426148, -122.1347209)
Position(47.6458676, -122.1356007) ]
)
.strokeWidth(8.)
.fillColor(Color.Red.ToFabColor())
.strokeColor (Color.Blue.ToFabColor())
// Draw a circle on the map
MapCircle(Position(37.79752, -122.40183), Distance(250.))
.fillColor(Color.FromHex("#88FFC0CB").ToFabColor())
.strokeColor(Color.FromHex("#88FF0000").ToFabColor())
.strokeWidth (8.)
// Draw a polyline on the map
MapPolyline(
[ Position(47.6381401, -122.1317367)
Position(47.6381473, -122.1350841)
Position(47.6382847, -122.1353094)
Position(47.6384582, -122.1354703)
Position(47.6401136, -122.1360819)
Position(47.6403883, -122.1364681)
Position(47.6407426, -122.1377019)
Position(47.6412558, -122.1404056)
Position(47.6414148, -122.1418647)
Position(47.6414654, -122.1432702) ]
)
.strokeColor(Color.Blue.ToFabColor())
.strokeWidth (12.)
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Fabulous.MauiControls (>= 10.0.2)
- Microsoft.Maui.Controls.Maps (>= 10.0.100)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
### Added
- Document the historical `Cmd` module breaking changes between Fabulous 2.4.x and 10.0.1 (removed `Cmd.ofSub`/`Cmd.dispatch`, the `Cmd.OfAsync`/`Cmd.OfTask` relocations, and the two-continuation `either` signature) in `docs/guides/migration.md` (#1336, #1337, #1338, #1339).
### Changed
- Bump the `Microsoft.NET.Test.Sdk` version from `18.9.0` to `18.10.0` in `Directory.Packages.props` (Repo Assist).
- Bump `BenchmarkDotNet` from `0.14.0` to `0.15.8` and `Microsoft.NET.Test.Sdk` from `18.10.0` to `18.10.1` in `Directory.Packages.props` (Repo Assist).
- Revert the `FSharp.Core` package version floor bump from `10.1.401` back to `10.0.100` in `Directory.Packages.props`, after CI (#1351, #1354) confirmed it triggers a `NullReferenceException` in Apple's `ILStrip` post-processing tool when building the `net10.0-ios` sample target, keeping the `Microsoft.NET.Test.Sdk`/`BenchmarkDotNet` bumps intact (Repo Assist, #1355).
- Suppress the 60 `FS0044` deprecation warnings from MAUI's own `[Obsolete]` attributes on `SwitchCell`/`EntryCell`/`Page.IsBusy`/`SafeArea` by adding `#nowarn "44"` to `Views/Cells/_Cell.fs`, `EntryCell.fs`, `SwitchCell.fs`, `Views/Pages/_Page.fs`, `ContentPage.fs`, and `Views/Layouts/_Layout.fs`, ahead of the 10.0.2 release (Repo Assist, #1344).
- Replace the immutable `Set`-based subscription-diffing in `Sub.Internal.diff`/`Sub.Internal.NewSubs.calculate` with a mutable `HashSet`, avoiding repeated O(log n) tree-node allocations on every `Program` update cycle (Repo Assist, #1202).
- Optimize `StackArray3.combine` to avoid an intermediate array allocation when merging a `Few`-cased value with a `Many`-cased array, writing directly into the final result array instead of allocating via `toArray`/`Array.append` (Repo Assist, #1234).
- Bump the `Avalonia` package version from `12.1.1` to `12.1.2` in `Directory.Build.props` (Repo Assist, #1317).
- Bump the `fabulous-avalonia` template's default `Avalonia`/`Avalonia.Desktop`/`Avalonia.Android`/`Avalonia.iOS`/`Avalonia.Themes.Fluent` package versions from `11.3.0` to `12.1.1` in `templates/avalonia/**/.template.config/template.json` (@kant2002, #1321).
- Document that the `fabulous-avalonia` single-project template's `net10.0-android`/`net10.0-ios` target frameworks require the `android`/`ios` .NET workloads, and document the previously-unlisted desktop-only `fabulous-avalonia-desktop` template as a workload-free alternative, in the Avalonia tutorial, get-started guide, and templates README (Repo Assist, #1319, #1326).
- Add Windows-from-Visual-Studio debugging guidance (Solution Platform selector, MSIX-packaged vs. unpackaged apps) to the MAUI tutorial and get-started guide (#1306, #1307, #1308, #1309, #1310, #1334, #1335).
- Fix formatting and clarify instructions in the Avalonia get-started guide and tutorial (#1329, #1330, #1331).
- Replace the dead Discord "Contact us" link with a mailto link in the website header (#1313).
### Fixed
- Add unit tests for `StackArray3`'s `add`, `get`, `find`, and `combine` operations, covering the `Few`/`Many` representation transitions and error paths that previously had no test coverage (Repo Assist).
- Route exceptions thrown by the leading-edge `emit` call in `DispatchThrottle.Dispatch` to `onError`, matching the error handling already used by the timer callback and `FlushAsync`, so a throwing dispatch handler no longer crashes the caller's dispatch thread (Repo Assist).