Skip to content

[automated] Merge branch 'net11.0' => 'release/11.0.1xx-preview2'#34260

Merged
PureWeen merged 16 commits intorelease/11.0.1xx-preview2from
merge/net11.0-to-release/11.0.1xx-preview2
Feb 27, 2026
Merged

[automated] Merge branch 'net11.0' => 'release/11.0.1xx-preview2'#34260
PureWeen merged 16 commits intorelease/11.0.1xx-preview2from
merge/net11.0-to-release/11.0.1xx-preview2

Conversation

@PureWeen
Copy link
Copy Markdown
Member

This PR merges commits from net11.0 into release/11.0.1xx-preview2.

Commits include:

Instructions for merging

Complete this PR by creating a merge commit, not a squash or rebase commit.

rmarinho and others added 15 commits February 23, 2026 15:15
### Description of Change

This pull request updates the CI pipeline configuration to introduce and
use a new Linux-based pool for running Android tests, replacing the
previous macOS-based pools. The main changes are the addition of the
`AndroidPoolLinux` parameter and updating the relevant test stage to use
this new pool.

**Pipeline configuration updates:**

* Added a new `AndroidPoolLinux` parameter to `parameters:` in
`eng/pipelines/ci.yml` for specifying a Linux pool (`MAUI-DNCENG`) with
the `1ESPT-Ubuntu22.04` image for Android test runs.
* Updated the `mac_runandroid_tests` stage to use the new
`AndroidPoolLinux` pool instead of the previous macOS-based pools,
ensuring Android tests run on Linux infrastructure.

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… Change (#32889)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details
- When TextColor is not specified and the theme is switched between dark
and light (and vice versa), the clearButton color in the Entry does not
update correctly.

### Root cause
- On iOS, The root cause of the issue is that on iOS, when the text
color is null, the clearButton.SetImage method reuses the same image
created in the light theme. This breaks iOS’s automatic theme handling,
causing the clear button color to remain unchanged.
- On Android, When entry.TextColor is null (default), the clear button
drawable's color filter was being cleared without applying the
appropriate theme color, making the button invisible on dark
backgrounds.

### Description of Change

- On Android, When TextColor is `null`, now properly retrieves the
system's `TextColorPrimary` attribute. Applies the correct color filter
to the clear button drawable. Respects the app theme by using the
enabled state color from the theme's color state list
- On iOS, When TextColor is `null`, now sets `clearButton.TintColor =
null` to use system default. Allows the clear button to adapt to the
current theme automatically. Ensures tinted clear button image uses
correct system colors

Validated the behaviour in the following platforms

- [x] Android
- [x] Windows ,
- [x] iOS,
- [x] MacOS

### Issues Fixed
Fixes #32886

### Output images
Android

<table>
<tr>
<td>
Before
</td>
<td>
After
</td>
</tr>
<tr>
<td>



https://github.com/user-attachments/assets/cde1145b-1440-442f-9cca-f7a2790500ab
</td>
<td>


https://github.com/user-attachments/assets/b072641b-182f-4189-843f-589261da90cc
</td>
</tr>
</table>
…#33198)

Updates the scripts to use the new Azure DevOps instance.

After this we can enable the dogfooding comment again so people can test
PRs easier.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
## Description

Introduces the `MauiXamlHotReload` MSBuild property to communicate to
the IDE which type of XAML Hot Reload implementation the application
expects.

### Values

| Value | Description |
|-------|-------------|
| `Legacy` (default) | Traditional XAML Hot Reload implementation |
| `SourceGen` | Source generator-based XAML Hot Reload (experimental) |

### Usage

```xml
<PropertyGroup>
  <MauiXamlHotReload>SourceGen</MauiXamlHotReload>
</PropertyGroup>
```

## IDE Behavior

### When `MauiXamlHotReload=Legacy` (Default)

The IDE should behave as it currently does:
- XAML Hot Reload enabled
- Full page refresh supported
- Incremental XAML Hot Reload supported

### When `MauiXamlHotReload=SourceGen`

The IDE **MUST**:
- Ensure C# Hot Reload is **enabled**
- Ensure legacy XAML Hot Reload is **disabled**
- Provide a mechanism to trigger the MAUI Update Handler (MUH)

The IDE **MUST NOT**:
- Trigger full page refresh (i.e., send updated XAML to the app)
- Use incremental XAML Hot Reload

The IDE **MAY** continue to support:
- VisualDiagnostics
- BindingDiagnostics

## Warning

When `MauiXamlHotReload=SourceGen` is set, warning MAUI1002 is emitted:
> MauiXamlHotReload is set to 'SourceGen'. Source generator-based XAML
Hot Reload is experimental and not yet fully implemented. Use at your
own risk.

## Migration Note

This property exists to facilitate migration from legacy XAML Hot Reload
to the source generator-based approach. In a future release, `Legacy`
may be deprecated with `SourceGen` becoming the only supported mode.

Fixes #34027

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These likely came over from the migration from xamarin/Xamarin.Forms ->
dotnet/maui.

`$(DebugType)=full` seems be causing the error at:

* #34201

```
    src\Controls\tests\Xaml.UnitTests\Issues\Gh2007.rtxc.xaml(3,9): XamlC warning XC0022: Binding could be compiled to improve runtime performance if x:DataType is specified. See https://learn.microsoft.com/dotnet/maui/fundamentals/data-binding/compiled-bindings for more information. [D:\a\_work\1\s\src\Controls\tests\Xaml.UnitTests\Controls.Xaml.UnitTests.csproj]
    Fatal error.
    0xC0000005
    at Mono.Cecil.Pdb.ISymUnmanagedWriter2.Close()
    at Mono.Cecil.Pdb.SymWriter.Close()
    at Mono.Cecil.Pdb.NativePdbWriter.Write()
    at Mono.Cecil.ModuleWriter.Write(Mono.Cecil.ModuleDefinition, Mono.Disposable`1<System.IO.Stream>, Mono.Cecil.WriterParameters)
    at Mono.Cecil.ModuleWriter.WriteModule(Mono.Cecil.ModuleDefinition, Mono.Disposable`1<System.IO.Stream>, Mono.Cecil.WriterParameters)
    at Mono.Cecil.ModuleDefinition.Write(System.IO.Stream, Mono.Cecil.WriterParameters)
    at Mono.Cecil.ModuleDefinition.Write(Mono.Cecil.WriterParameters)
    at Mono.Cecil.AssemblyDefinition.Write(Mono.Cecil.WriterParameters)
    at Microsoft.Maui.Controls.Build.Tasks.XamlCTask.Execute(System.Collections.Generic.IList`1<System.Exception> ByRef)
    at Microsoft.Maui.Controls.Build.Tasks.XamlTask.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder+<ExecuteInstantiatedTask>d__25.MoveNext()
    at Microsoft.Build.BackEnd.TaskBuilder+<InitializeAndExecuteTask>d__23.MoveNext()
    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.Build.BackEnd.TaskBuilder+<InitializeAndExecuteTask>d__23, Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]](<InitializeAndExecuteTask>d__23 ByRef)
    at Microsoft.Build.BackEnd.TaskBuilder+<ExecuteBucket>d__19.MoveNext()
    at Microsoft.Build.BackEnd.TaskBuilder+<ExecuteTask>d__18.MoveNext()
    at Microsoft.Build.BackEnd.TaskBuilder+<ExecuteTask>d__13.MoveNext()
    at Microsoft.Build.BackEnd.TargetEntry+<ProcessBucket>d__50.MoveNext()
    at Microsoft.Build.BackEnd.TargetEntry+<ExecuteTarget>d__43.MoveNext()
    at Microsoft.Build.BackEnd.TargetBuilder+<ProcessTargetStack>d__24.MoveNext()
    at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=11.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Build.BackEnd.TargetBuilder+<ProcessTargetStack>d__24, Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
    at System.Threading.Tasks.TaskSchedulerAwaitTaskContinuation+<>c.<Run>b__2_0(System.Object)
    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
    at System.Threading.Tasks.Task.ExecuteEntry()
    at Microsoft.Build.BackEnd.RequestBuilder+DedicatedThreadsTaskScheduler.<InjectThread>b__6_0()
    at System.Threading.Thread+StartHelper.Callback(System.Object)
    at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
    at System.Threading.Thread.StartCallback()
    Build failed with exit code 57005. Check errors above.
```

We shouldn't be using Windows-specific debug settings in a
cross-platform project -- the `$(DebugType)` setting is not needed.

I went through a couple projects and found old debugging settings that
would have been needed in non-SDK-style projects, but are not needed in
SDK-style projects. Removing those settings to cleanup the repo.
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Description

Adds `IsVisible` and `ZIndex` properties to all map elements (Polygon,
Polyline, Circle), enabling visibility toggling and draw-order control
without removing elements from the map.

Part of the Maps Control Improvements Epic: #33787 (Phase 4: MapElement
Improvements)

## Changes

### Core Interface (`IMapElement`)
- `bool IsVisible { get; }` — controls element visibility (default:
`true`)
- `int ZIndex { get; }` — controls draw order/layering (default: `0`)

### Controls (`MapElement`)
- `IsVisibleProperty` BindableProperty (bool, default: true)
- `ZIndexProperty` BindableProperty (int, default: 0)

### Platform Implementations

**Android:**
- `Polygon.Visible`, `Polyline.Visible`, `Circle.Visible` for visibility
- `Polygon.ZIndex`, `Polyline.ZIndex`, `Circle.ZIndex` for draw order
- Initial values applied after `map.Add*()` calls; runtime changes via
`*OnPropertyChanged`

**iOS/MacCatalyst:**
- Visibility via `MKOverlayRenderer.Alpha` (0 = hidden, 1 = visible)
- ZIndex is no-op (MapKit does not support fine-grained overlay
ordering)

### Tests
- 5 new unit tests (MapElementIsVisibleDefaultIsTrue,
MapElementIsVisibleCanBeSet, MapElementZIndexDefaultIsZero,
MapElementZIndexCanBeSet, MapElementIsVisibleWorksOnAllTypes)

### Sample
- MapElementVisibilityGallery with toggle buttons for each element type
and ZIndex controls

## Verified Working
- ✅ Android: Toggle Polygon/Polyline/Circle visibility, ZIndex changes
(Z=10), Reset
- ✅ iOS: Toggle Polygon/Polyline/Circle visibility, ZIndex changes,
Reset
- ✅ 34 unit tests pass (including 5 new)

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Description

When binding `Entry.Text` to a nullable value type property (e.g.,
`int?`), clearing the Entry now correctly sets the property to `null`
instead of retaining the previous value.

## Issue

Fixes #8342

## Root Cause

In `BindingExpressionHelper.TryConvert()`, when converting an empty
string to a nullable type like `int?`:
1. The underlying type was extracted (`int`)
2. `Convert.ChangeType("", int)` was called, which throws
`FormatException`
3. The catch block returned `false`, keeping the old value

## Solution

Added a check before `Convert.ChangeType()` to handle empty/whitespace
strings when converting to nullable types. When the target type is
nullable and the source is an empty/whitespace string, the value is set
to `null` and the conversion succeeds.

## Behavior

| Target Type | Empty String Input | Result |
|-------------|-------------------|--------|
| `int?`, `double?`, etc. (nullable) | `""` | `null` ✅ |
| `int`, `double`, etc. (non-nullable) | `""` | Conversion fails,
retains last valid value (unchanged) |

## Testing

Added two unit tests in `BindingUnitTests.cs`:
- `TwoWayBindingToIntPropertyWithEmptyStringRetainsLastValidValue` -
Verifies non-nullable int behavior
- `TwoWayBindingToNullableIntPropertyWithEmptyStringBecomesNull` -
Verifies nullable int now converts to null
…space (#34055)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Description

Fixes #34039

When `<Setter.Value>` is used as a property element, `GetValueNode()` in
`SetterValueProvider.cs` looked up the `Value` property only by two
specific namespace URIs (`""` and `MauiUri`). When the property element
resolved to `MauiGlobalUri` instead, the lookup returned null. Since PR
#33681 changed the null-return behavior to a skip sentinel, this caused
the Setter to be removed from `Variables` entirely, preventing the
`.Add()` call from being generated.

### Root Cause

`GetValueNode()` checked only two namespace URIs:
```csharp
node.Properties.TryGetValue(new XmlName("", "Value"), out valueNode)
node.Properties.TryGetValue(new XmlName(XamlParser.MauiUri, "Value"), out valueNode)
```

Property elements like `<Setter.Value>` inherit their namespace URI from
the XML reader, which varies depending on the xmlns declaration used.
When the XAML used `MauiGlobalUri`, neither existing check matched, so
`GetValueNode()` returned null, triggering the skip sentinel introduced
in #33681, which suppressed the `Setters.Add()` call.

### Fix

Added `MauiGlobalUri` as a third namespace to check in the
`GetValueNode()` lookup chain:

```csharp
!node.Properties.TryGetValue(new XmlName("", "Value"), out valueNode) &&
!node.Properties.TryGetValue(new XmlName(XamlParser.MauiUri, "Value"), out valueNode) &&
!node.Properties.TryGetValue(new XmlName(XamlParser.MauiGlobalUri, "Value"), out valueNode) &&
```

### Testing

- Added XAML unit test (`Maui34039`) verifying Setter with property
element value in a Trigger
- Added SourceGen unit test (`SetterValueInTrigger`) verifying correct
codegen
- Tests fail without fix, pass with fix

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Summary
- fix SourceGen handling for `<OnPlatform x:TypeArguments="View">` when
no matching platform/default exists
- avoid nullability and null-dereference codegen by using `default!` for
reference-type placeholders
- skip namescope/source-info operations for OnPlatform default
placeholder nodes
- add regression coverage for the View OnPlatform missing-platform
scenario

## Related issues
- Fixes #34074

## Validation
- `dotnet test
src/Controls/tests/SourceGen.UnitTests/SourceGen.UnitTests.csproj
--filter
"SimplifyOnPlatform.OnPlatformWithMissingTargetPlatformShouldUseDefault|SimplifyOnPlatform.OnPlatformViewWithMissingTargetPlatformShouldNotEmitNullabilityWarnings"`

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Description
Fixes two SourceGen nullability issues reported in #34130:

- avoid nullable-unboxing warnings by null-forgiving
`IExtendedTypeConverter` results before value-type casts
- preserve nullable generic type arguments in BindingSourceGen type
names while avoiding invalid nullable top-level type syntax

Also adds `Maui34130` Xaml.UnitTest coverage across Runtime and
SourceGen inflators.

## Validation
- `dotnet build
src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj -nologo
-v minimal`
- `dotnet test
src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj
--filter "FullyQualifiedName~Maui34130" -nologo -v minimal`

## fixes
- fixes #34130

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Summary
- fix RelayCommand inference for generated command properties when
source methods use `On*`, `*Async`, or `On*Async` naming
- prevent MAUIG2045 false positives for compiled bindings that target
those generated command properties
- add regression coverage in BindingSourceGen and SourceGen unit tests

## Related issues
- Fixes #34029
- Duplicate issue #34086 was closed in favor of #34029

## Validation
- `dotnet test
src/Controls/tests/BindingSourceGen.UnitTests/Controls.BindingSourceGen.UnitTests.csproj
--filter
"RelayCommandTests.DetectsRelayCommandMethodWithOnPrefixAndAsyncSuffix"`
- `dotnet test
src/Controls/tests/SourceGen.UnitTests/SourceGen.UnitTests.csproj
--filter
"BindingDiagnosticsTests.BindingToRelayCommandGeneratedFromOnAsyncMethod_DoesNotReportPropertyNotFound"`

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…es (#33963)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Description

Adds rule #2 to the Git Workflow section in copilot-instructions.md:

**When fixing CI or amending an existing PR, commit directly to the PR
branch.** Do not create a separate branch off a PR branch — the PR
branch already IS a feature branch. Creating a new branch means CI will
not run on the PR, defeating the purpose.

Also adds a code example showing the correct workflow (`gh pr checkout`
→ commit → push).

## Motivation

Copilot CLI was incorrectly creating separate branches when asked to fix
CI on existing PRs, because rule #1 ("never commit to main, create a
feature branch") was being over-generalized to PR branches. This caused
wasted time since CI only runs on PR branches.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
I detected changes in the main branch which have not been merged yet to
net11.0. I'm a robot and am configured to help you automatically keep
net11.0 up to date, so I've opened this PR.

This PR merges commits made on main by the following committers:

* rmarinho

## Instructions for merging from UI

This PR will not be auto-merged. When pull request checks pass, complete
this PR by creating a merge commit, *not* a squash or rebase commit.

<img alt="merge button instructions"
src="https://i.imgur.com/GepcNJV.png" width="300" />

If this repo does not allow creating merge commits from the GitHub UI,
use command line instructions.

## Instructions for merging via command line

Run these commands to merge this pull request from the command line.

``` sh
git fetch
git checkout main
git pull --ff-only
git checkout net11.0
git pull --ff-only
git merge --no-ff main

# If there are merge conflicts, resolve them and then run git merge --continue to complete the merge
# Pushing the changes to the PR branch will re-trigger PR validation.
git push https://github.com/dotnet/maui HEAD:merge/main-to-net11.0
```

<details>
<summary>or if you are using SSH</summary>

```
git push git@github.com:dotnet/maui HEAD:merge/main-to-net11.0
```

</details>


After PR checks are complete push the branch
```
git push
```

## Instructions for resolving conflicts

:warning: If there are merge conflicts, you will need to resolve them
manually before merging. You can do this [using GitHub][resolve-github]
or using the [command line][resolve-cli].

[resolve-github]:
https://help.github.com/articles/resolving-a-merge-conflict-on-github/
[resolve-cli]:
https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/

## Instructions for updating this pull request

Contributors to this repo have permission update this pull request by
pushing to the branch 'merge/main-to-net11.0'. This can be done to
resolve conflicts or make other changes to this pull request before it
is merged.
The provided examples assume that the remote is named 'origin'. If you
have a different remote name, please replace 'origin' with the name of
your remote.

```
git fetch
git checkout -b merge/main-to-net11.0 origin/net11.0
git pull https://github.com/dotnet/maui merge/main-to-net11.0
(make changes)
git commit -m "Updated PR with my changes"
git push https://github.com/dotnet/maui HEAD:merge/main-to-net11.0
```

<details>
    <summary>or if you are using SSH</summary>

```
git fetch
git checkout -b merge/main-to-net11.0 origin/net11.0
git pull git@github.com:dotnet/maui merge/main-to-net11.0
(make changes)
git commit -m "Updated PR with my changes"
git push git@github.com:dotnet/maui HEAD:merge/main-to-net11.0
```

</details>

Contact .NET Core Engineering (dotnet/dnceng) if you have questions or
issues.
Also, if this PR was generated incorrectly, help us fix it. See
https://github.com/dotnet/arcade/blob/main/.github/workflows/scripts/inter-branch-merge.ps1.

---------

Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Reset patterns:
- global.json
- NuGet.config
- eng/Version.Details.xml
- eng/Versions.props
- eng/common/*
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

This PR adds support for detecting click interactions on Circle,
Polygon, and Polyline elements within the .NET MAUI Map control.

**Enhancements over original proposal:**
- Added `PolylineClicked` event (in addition to Circle and Polygon)
- Rebased onto net11.0 branch
- Added proper PublicAPI.Unshipped.txt entries
- Added sample gallery page (`MapElementClickGallery`)
- Added unit tests for click events

### Platforms Affected
- Android: Uses `IOnCircleClickListener`, `IOnPolygonClickListener`,
`IOnPolylineClickListener`
- iOS/MacCatalyst: Uses hit testing in tap gesture recognizer

### Public API Changes

```csharp
// Circle
circle.CircleClicked += (s, e) =>
{
    DisplayAlert("Circle Clicked", "You clicked the circle!", "OK");
};

// Polygon
polygon.PolygonClicked += (s, e) =>
{
    DisplayAlert("Polygon Clicked", "You clicked the polygon!", "OK");
};

// Polyline (NEW)
polyline.PolylineClicked += (s, e) =>
{
    DisplayAlert("Polyline Clicked", "You clicked the polyline!", "OK");
};
```

### Issues Fixed

Fixes #28825

---

### Original Proposal

> This PR proposes support for detecting click interactions on Polygon,
and Circle elements within the .NET MAUI Map control.

### Demo

|Android|iOS|
|--|--|
|<video
src="https://github.com/user-attachments/assets/900920c0-580c-4b62-afd7-d452b4013d90"
width="300px"/>|<video
src="https://github.com/user-attachments/assets/d53c9c29-5060-417e-b3f8-9c7b8278b8a1"
width="300px"/>|

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>

---------

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 26, 2026 14:50
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 26, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34260

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34260"

@PureWeen
Copy link
Copy Markdown
Member Author

/azp run maui-pr-uitests, maui-pr-devicetests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR merges multiple features and fixes from net11.0 into release/11.0.1xx-preview2, including map control enhancements, binding improvements, and build system updates.

Changes:

  • Adds click events for Circle, Polygon, and Polyline map elements with platform-specific implementations
  • Adds IsVisible and ZIndex properties to map elements for controlling visibility and draw order
  • Fixes empty string binding to nullable value types to properly convert to null
  • Adds MauiXamlHotReload property for IDE communication with validation
  • Updates Linux build configuration to use maui-android workload and strip non-Android TFMs

Reviewed changes

Copilot reviewed 43 out of 43 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/TestUtils/src/Microsoft.Maui.IntegrationTests/AndroidTemplateTests.cs Adds method to strip non-Android TFMs from project files on Linux
src/DotNet/DotNet.csproj Conditionally installs maui-android workload on Linux instead of full maui workload
src/Core/maps/src/PublicAPI/*/PublicAPI.Unshipped.txt Updates public API surface with new map element properties and methods
src/Core/maps/src/Platform/iOS/MauiMKMapView.cs Implements hit-testing for circle, polygon, and polyline click events on iOS
src/Core/maps/src/Handlers/MapElement/*.cs Adds IsVisible and ZIndex property handlers for all platforms
src/Core/maps/src/Handlers/Map/MapHandler.Android.cs Implements click listeners and visibility/ZIndex support for Android map elements
src/Core/maps/src/Core/IMapElement.cs Adds IsVisible, ZIndex properties and Clicked method to interface
src/Controls/tests/Core.UnitTests/MapTests.cs Adds unit tests for new map element properties and click events
src/Controls/tests/Core.UnitTests/BindingUnitTests.cs Adds tests for empty string binding to nullable value types
src/Controls/src/Core/BindingExpressionHelper.cs Fixes empty string conversion to properly handle nullable value types
src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets Adds MauiXamlHotReload property with validation
src/Controls/samples/Controls.Sample/Pages/Controls/MapsGalleries/*.cs Adds sample gallery pages demonstrating new map element features
src/Controls/Maps/src/*.cs Implements IsVisible, ZIndex properties and click events in map element classes
eng/pipelines/common/*.yml Refactors KVM enablement into reusable template
eng/pipelines/ci.yml Adds AndroidPoolLinux parameter definition
Comments suppressed due to low confidence (1)

src/Core/maps/src/Platform/iOS/MauiMKMapView.cs:1

  • The magic number 44 appears twice in this line without explanation. Consider extracting this as a named constant (e.g., MinimumTapTargetWidth) to improve code clarity and maintainability.

// See: https://github.com/dotnet/maui/issues/8342
if (underlyingType != null && value is string && string.IsNullOrEmpty(stringValue))
{
value = null!;
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null-forgiving operator (!) is used here to suppress warnings, but setting value to null is semantically correct. Consider using a simple value = null; assignment instead, as the nullable context should allow this for nullable value types.

Suggested change
value = null!;
value = null;

Copilot uses AI. Check for mistakes.
I detected changes in the main branch which have not been merged yet to
net11.0. I'm a robot and am configured to help you automatically keep
net11.0 up to date, so I've opened this PR.

This PR merges commits made on main by the following committers:

* StephaneDelcroix
* jonathanpeppers
* jfversluis
* TamilarasanSF4853
* rmarinho

## Instructions for merging from UI

This PR will not be auto-merged. When pull request checks pass, complete
this PR by creating a merge commit, *not* a squash or rebase commit.

<img alt="merge button instructions"
src="https://i.imgur.com/GepcNJV.png" width="300" />

If this repo does not allow creating merge commits from the GitHub UI,
use command line instructions.

## Instructions for merging via command line

Run these commands to merge this pull request from the command line.

``` sh
git fetch
git checkout main
git pull --ff-only
git checkout net11.0
git pull --ff-only
git merge --no-ff main

# If there are merge conflicts, resolve them and then run git merge --continue to complete the merge
# Pushing the changes to the PR branch will re-trigger PR validation.
git push https://github.com/dotnet/maui HEAD:merge/main-to-net11.0
```

<details>
<summary>or if you are using SSH</summary>

```
git push git@github.com:dotnet/maui HEAD:merge/main-to-net11.0
```

</details>


After PR checks are complete push the branch
```
git push
```

## Instructions for resolving conflicts

:warning: If there are merge conflicts, you will need to resolve them
manually before merging. You can do this [using GitHub][resolve-github]
or using the [command line][resolve-cli].

[resolve-github]:
https://help.github.com/articles/resolving-a-merge-conflict-on-github/
[resolve-cli]:
https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/

## Instructions for updating this pull request

Contributors to this repo have permission update this pull request by
pushing to the branch 'merge/main-to-net11.0'. This can be done to
resolve conflicts or make other changes to this pull request before it
is merged.
The provided examples assume that the remote is named 'origin'. If you
have a different remote name, please replace 'origin' with the name of
your remote.

```
git fetch
git checkout -b merge/main-to-net11.0 origin/net11.0
git pull https://github.com/dotnet/maui merge/main-to-net11.0
(make changes)
git commit -m "Updated PR with my changes"
git push https://github.com/dotnet/maui HEAD:merge/main-to-net11.0
```

<details>
    <summary>or if you are using SSH</summary>

```
git fetch
git checkout -b merge/main-to-net11.0 origin/net11.0
git pull git@github.com:dotnet/maui merge/main-to-net11.0
(make changes)
git commit -m "Updated PR with my changes"
git push git@github.com:dotnet/maui HEAD:merge/main-to-net11.0
```

</details>

Contact .NET Core Engineering (dotnet/dnceng) if you have questions or
issues.
Also, if this PR was generated incorrectly, help us fix it. See
https://github.com/dotnet/arcade/blob/main/.github/workflows/scripts/inter-branch-merge.ps1.
@PureWeen
Copy link
Copy Markdown
Member Author

/azp run maui-pr-uitests, maui-pr-devicetests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@PureWeen PureWeen merged commit 8bbb579 into release/11.0.1xx-preview2 Feb 27, 2026
170 of 184 checks passed
@PureWeen PureWeen deleted the merge/net11.0-to-release/11.0.1xx-preview2 branch February 27, 2026 04:48
@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants