Skip to content

v8.0.0: Compiled Bindings, Improved Complex (Nested) Bindings, .NET 11 Compatibility

Latest

Choose a tag to compare

@TheCodeTraveler TheCodeTraveler released this 24 Jul 16:55
· 8 commits to main since this release
Immutable release. Only release title and notes can be modified.
6fef5c9

.NET 11 Compatibility

This release provides compatibility for the upcoming release of .NET 11.

In .NET 11, CommunityToolkit.Maui.Markup will no longer have access to internal .NET MAUI APIs. This release removes our use of internal .NET MAUI APIs to ensure compatibility with .NET 11.

Important

We recommend every .NET MAUI app preparing for .NET 11 install this release, v8.0.0 (or later), before .NET 11 is released in November. Apps running CommunityToolkit.Maui.Markup v7.0.1 and earlier will not be compatible with .NET 11.

Compiled Bindings

Thanks to @stephenquan, markup bindings now support BindingBase.Create 🎉

BindingBase bindings support compiled bindings created with the BindingBase.Create method. This approach supports nested, one-way, and two-way bindings. For example, the following code creates a nested two-way binding to ViewModel.NestedObject.Text:

new Entry().Bind(
    Entry.TextProperty,
    BindingBase.Create(static (ViewModel vm) => vm.NestedObject.Text, BindingMode.TwoWay));

Improved Complex Bindings

Complex (aka Nested) Bindings are now easier than ever! There is now no need to add the handlers parameter.

Using the below ViewModel class, we can create a nested two-way binding directly to ViewModel.NestedObject.Text:

New Way

new Entry().Bind(
    Entry.TextProperty,
    getter: static (ViewModel vm) => vm.NestedObject.Text,
    setter: static (ViewModel vm, string text) => vm.NestedObject.Text = text);

Old Way

new Entry().Bind(
    Entry.TextProperty,
    getter: static (ViewModel vm) => vm.NestedObject.Text,
    handlers:  // Obsolete
    [
        (vm => vm, nameof(ViewModel.NestedObject)),
        (vm => vm.NestedObject, nameof(ViewModel.NestedObject.Text)),
    ],
    setter: static (ViewModel vm, string text) => vm.NestedObject.Text = text);
class ViewModel
{
    public NestedObject NestedObject { get; set; } = new()

    public string Text { get; set; } = string.Empty;
}

class NestedObject
{
    public string Text { get; set; } = string.Empty;
}

What's Changed

  • Add actions read permission to NuGet release job by @jfversluis in #470
  • Add BindingBase Bind overload + tests for nested path propagation by @stephenquan in
  • Remove .NET MAUI internals usage by @jfversluis in #452

New Contributors

Housekeeping

  • Bump actions/download-artifact from 7 to 8 by @dependabot[bot] in #415
  • Bump actions/upload-artifact from 6 to 7 by @dependabot[bot] in #414
  • Bump BenchmarkDotNet from 0.15.6 to 0.15.8 by @dependabot[bot] in #418
  • Bump Microsoft.CodeAnalysis.CSharp.Workspaces from 4.14.0 to 5.3.0 by @dependabot[bot] in #422
  • Bump Microsoft.CodeAnalysis.CSharp from 4.14.0 to 5.3.0 by @dependabot[bot] in #421
  • Bump Refit.HttpClientFactory from 8.0.0 to 10.1.6 by @dependabot[bot] in #423
  • Bump CommunityToolkit.Mvvm from 8.4.0 to 8.4.2 by @dependabot[bot] in #420
  • Bump CommunityToolkit.Mvvm from 8.4.0 to 8.4.2 by @dependabot[bot] in #424
  • Bump Microsoft.Extensions.Http.Resilience from 10.0.0 to 10.6.0 by @dependabot[bot] in #425
  • Bump Microsoft.NET.Test.Sdk from 18.0.1 to 18.5.1 by @dependabot[bot] in #428
  • Bump NUnit from 4.4.0 to 4.6.0 by @dependabot[bot] in #430
  • Bump NUnit.Analyzers from 4.11.2 to 4.13.0 by @dependabot[bot] in #431
  • Bump NUnit from 4.6.0 to 4.6.1 by @dependabot[bot] in #434
  • Bump Microsoft.Testing.Extensions.CodeCoverage from 18.0.4 to 18.7.0 by @dependabot[bot] in #433
  • Bump NUnit3TestAdapter from 5.2.0 to 6.2.0 by @dependabot[bot] in #432
  • Bump PolySharp from 1.15.0 to 1.16.0 by @dependabot[bot] in #435
  • Bump Microsoft.NET.Test.Sdk from 18.5.1 to 18.6.0 by @dependabot[bot] in #436
  • Bump actions/setup-dotnet from 5.2.0 to 5.3.0 by @dependabot[bot] in #440
  • Bump actions/checkout from 6.0.2 to 6.0.3 by @dependabot[bot] in #439
  • Bump NUnit.Analyzers from 4.13.0 to 4.14.0 by @dependabot[bot] in #438
  • Bump CommunityToolkit.Maui from 14.1.1 to 14.2.0 by @dependabot[bot] in #437
  • Bump Refit.HttpClientFactory from 10.1.6 to 11.0.0 by @dependabot[bot] in #441
  • Bump Microsoft.Testing.Extensions.CodeCoverage from 18.7.0 to 18.8.0 by @dependabot[bot] in #443
  • Bump Refit.HttpClientFactory from 11.0.0 to 11.0.1 by @dependabot[bot] in #442
  • Bump Microsoft.Extensions.Http.Resilience from 10.6.0 to 10.7.0 by @dependabot[bot] in #444
  • Bump Microsoft.Maui.Controls.Compatibility from 10.0.70 to 10.0.71 by @dependabot[bot] in #446
  • Bump Refit.HttpClientFactory from 11.0.1 to 11.1.0 by @dependabot[bot] in #447
  • Bump actions/setup-java from 5.2.0 to 5.3.0 by @dependabot[bot] in #448
  • Bump actions/checkout from 6.0.3 to 7.0.0 by @dependabot[bot] in #449
  • Bump Refit.HttpClientFactory from 11.1.0 to 11.2.0 by @dependabot[bot] in #450
  • Bump Microsoft.NET.Test.Sdk from 18.6.0 to 18.7.0 by @dependabot[bot] in #451
  • Bump Refit.HttpClientFactory from 11.2.0 to 12.0.0 by @dependabot[bot] in #453
  • Bump Microsoft.Maui.Controls from 10.0.71 to 10.0.80 by @dependabot[bot] in #454
  • Bump actions/setup-java from 5.3.0 to 5.4.0 by @dependabot[bot] in #456
  • Bump Refit.HttpClientFactory from 12.0.0 to 12.1.0 by @dependabot[bot] in #458
  • Bump actions/setup-dotnet from 5.3.0 to 5.4.0 by @dependabot[bot] in #457
  • Bump Refit.HttpClientFactory from 12.1.0 to 13.0.0 by @dependabot[bot] in #459
  • Bump Microsoft.Testing.Extensions.CodeCoverage from 18.8.0 to 18.9.0 by @dependabot[bot] in #464
  • Bump Refit.HttpClientFactory from 13.0.0 to 13.1.0 by @dependabot[bot] in #463
  • Bump actions/setup-java from 5.4.0 to 5.5.0 by @dependabot[bot] in #466
  • Bump Microsoft.NET.Test.Sdk from 18.7.0 to 18.8.1 by @dependabot[bot] in #468
  • Bump Microsoft.Extensions.Http.Resilience from 10.7.0 to 10.8.0 by @dependabot[bot] in #469
  • Use NuGet trusted publishing by @jfversluis in #460
  • Bump CommunityToolkit.Maui from 14.2.0 to 14.2.2 by @dependabot[bot] in #471
  • Bump actions/setup-dotnet from 5.4.0 to 6.0.0 by @dependabot[bot] in #474
  • Bump actions/setup-java from 5.5.0 to 5.6.0 by @dependabot[bot] in #473
  • Bump actions/checkout from 7.0.0 to 7.0.1 by @dependabot[bot] in #472
    #417
  • Bump Microsoft.Maui.Controls from 10.0.80 to 10.0.90 by @dependabot[bot] in #475
  • Bump Microsoft.Maui.Controls.Compatibility from 10.0.80 to 10.0.90 by @dependabot[bot] in #476

Full Changelog: 7.0.1...v8.0.0