Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion docs/fundamentals/data-binding/compiled-bindings.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Compiled bindings"
description: "Compiled bindings can be used to improve data binding performance in .NET MAUI applications."
ms.date: 03/24/2026
ms.date: 08/11/2026
---

# Compiled bindings
Expand Down Expand Up @@ -184,6 +184,27 @@ Then, ensure that all your bindings are annotated with the correct `x:DataType`

::: moniker-end

::: moniker range=">=net-maui-11.0"

### Compile relative source ancestor bindings

In .NET MAUI 11, the XAML source generator can compile a binding that uses [`RelativeSource`](xref:Microsoft.Maui.Controls.Xaml.RelativeSourceExtension) with a resolvable `AncestorType`. The source generator uses the ancestor type as the binding source type, so an inline `x:DataType` isn't required:

```xaml
<Button Command="{Binding Source={RelativeSource AncestorType={x:Type local:PeopleViewModel}},
Path=DeleteEmployeeCommand}" />
```

When the ancestor type and binding path can be resolved at compile time, the source generator generates a trim-safe compiled binding rather than a reflection-based binding. This makes the binding safe for full trimming and NativeAOT.

`RelativeSource` bindings that use `Self` or `TemplatedParent` continue to use runtime bindings.

For an `x:Reference` binding, the source generator resolves the referenced element type and compiles the binding when it can resolve the binding path. If it resolves the element type but can't compile the path, it generates a string-based runtime binding and suppresses the `MAUIG2045` warning. An `x:Reference` name that isn't found in any XAML namescope produces a `MAUIG1001` XAML compiler error.

Similarly, if `AncestorType` can't be resolved, XAML compilation fails.

::: moniker-end

### Combine compiled bindings with classic bindings in XAML

Binding expressions are only compiled for the view hierarchy that the `x:DataType` attribute is defined on. Conversely, any views in a hierarchy on which the `x:DataType` attribute is not defined will use classic bindings. It's therefore possible to combine compiled bindings and classic bindings on a page. For example, in the previous section the views within the <xref:Microsoft.Maui.Controls.DataTemplate> use compiled bindings, while the <xref:Microsoft.Maui.Controls.BoxView> that's set to the color selected in the <xref:Microsoft.Maui.Controls.ListView> does not.
Expand Down
22 changes: 21 additions & 1 deletion docs/xaml/hot-reload.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "XAML Hot Reload for .NET MAUI"
description: "Learn how to reload changes to your .NET MAUI XAML file instantly on your running app, so you don't have to rebuild your .NET MAUI project after every XAML change."
ms.date: 03/24/2026
ms.date: 08/11/2026
---

# XAML Hot Reload for .NET MAUI
Expand Down Expand Up @@ -37,6 +37,26 @@ XAML Hot Reload is enabled by default in Visual Studio 2022. If it's been previo

Then, on iOS in your build settings, check that the Linker is set to "Don't Link".

::: moniker range=">=net-maui-11.0"

### Enable XAML Incremental Hot Reload

.NET MAUI 11 Preview 7 includes a new XAML Incremental Hot Reload engine. The engine is enabled by default for `Debug` builds and disabled by default for `Release` and publish builds. It generates patches for edits to existing `x:Class`-backed XAML pages and controls, and applies them to every live instance of the affected type. Therefore, pages that have already been instantiated can be updated without being recreated or navigated to again. This engine also enables XAML updates when you use `dotnet watch`.

To opt out of XAML Incremental Hot Reload for debug builds, add the following property group to your project file:

```xml
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<EnableMauiIncrementalHotReload>false</EnableMauiIncrementalHotReload>
</PropertyGroup>
```

Supported edits include changing properties and bindings, editing resources declared in a page or control, and adding, removing, or reordering child elements. Not every XAML edit can be applied incrementally to live instances. For example, changing an `x:Name` or a root element type requires you to recreate the affected page. A change that requires C# code to be reloaded, or adding, removing, or renaming files or NuGet packages, requires you to rebuild and redeploy your app.

When `EnableMauiIncrementalHotReload` is `false`, the existing XAML Hot Reload engine remains active.

::: moniker-end

## Reload on multiple platforms

XAML Hot Reload supports simultaneous debugging of multiple platforms in Visual Studio, provided that you have separate head projects per platform rather than a single project app. For example, you can deploy an Android and an iOS target at the same time to see your changes reflected on both platforms at once. To debug on multiple platforms on Windows, see [How To: Set multiple startup projects](/visualstudio/ide/how-to-set-multiple-startup-projects).
Expand Down
Loading