Skip to content

Commit

Permalink
CS2072 can occur (#2678)
Browse files Browse the repository at this point in the history
* CS2072 can occur.

* Edit.
  • Loading branch information
davidbritch authored Dec 13, 2024
1 parent 295f20b commit bc8fd63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/fundamentals/data-binding/compiled-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ static (PersonViewModel vm) => vm.Address?.Street + " " + vm.Address?.City;
static (PersonViewModel vm) => $"Name: {vm.Name}";
```

> [!WARNING]
> A CS0272 compiler error will occur if the set accessor for a property or indexer is inaccessible. If this occurs, increase the accessibility of the accessor.
In addition, the <xref:Microsoft.Maui.Controls.BindingBase.Create%2A?displayProperty=nameWithType> method sets the binding directly on the object with a `Func`, and returns the binding object instance:

```csharp
Expand Down
7 changes: 6 additions & 1 deletion docs/whats-new/dotnet-9.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: What's new in .NET MAUI for .NET 9
description: Learn about the new features introduced in .NET MAUI for .NET 9.
ms.date: 11/29/2024
ms.date: 12/13/2024
---

# What's new in .NET MAUI for .NET 9
Expand Down Expand Up @@ -258,6 +258,9 @@ static (PersonViewModel vm) => vm.Address?.Street + " " + vm.Address?.City;
static (PersonViewModel vm) => $"Name: {vm.Name}";
```

> [!WARNING]
> A CS0272 compiler error will occur if the set accessor for a property or indexer is inaccessible. If this occurs, increase the accessibility of the accessor.
In addition, .NET MAUI 9 adds a <xref:Microsoft.Maui.Controls.BindingBase.Create%2A?displayProperty=nameWithType> method that sets the binding directly on the object with a `Func`, and returns the binding object instance:

```csharp
Expand Down Expand Up @@ -289,6 +292,8 @@ myEntry.SetBinding(Entry.TextProperty, new MultiBinding
> [!IMPORTANT]
> Compiled bindings are required instead of string-based bindings in NativeAOT apps, and in apps with full trimming enabled.
For more information about compiled bindings in code, see [Compiled bindings in code](~/fundamentals/data-binding/compiled-bindings.md?view=net-maui-9.0&preserve-view=true#compiled-bindings-in-code).

## Compiled bindings in XAML

In .NET MAUI 8, compiled bindings are disabled for any XAML binding expressions that define the `Source` property, and are unsupported on multi-bindings. These restrictions have been removed in .NET MAUI 9. For information about compiling XAML binding expressions that define the `Source` property, see [Compile bindings that define the `Source` property](~/fundamentals/data-binding/compiled-bindings.md?view=net-maui-9.0&preserve-view=true#compile-bindings-that-define-the-source-property).
Expand Down

0 comments on commit bc8fd63

Please sign in to comment.