1
0
mirror of synced 2025-12-19 09:50:46 -05:00
Files
core/release-notes/10.0/preview/preview5/dotnetmaui.md
James Montemagno 215900a2bd .NET 10 Preview 5 (#9829)
* .NET 10 Preview 5

* update

* lint

* Add C# features in preview 5

Write the description for user defined compound assignment operators.

* Revert "Add C# features in preview 5"

This reverts commit 42e5ac6bff.

* Remove VB release notes for P5

There aren't notable new features in Visual Basic for Preview 5.

* Add notes about PQC

* Add PQC to the libraries ToC

* .NET 10 P5 - WinForms (#9919)

* winforms

* WinForms Preview 5

Preview 5 updates

* Fix duplicated intro

---------

Co-authored-by: Merrie McGaw <mmcgaw@microsoft.com>
Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com>

* .NET 10 P5 - Containers (#9917)

* containers

* update for p5

* .NET 10 P5 - WPF (#9918)

* wpf

* Add notes

---------

Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com>

* .NET 10 P5 Runtime (#9912)

* Update for Runtime

* Add JIT notes

* Fix GC notes

---------

Co-authored-by: Aman Khalid (from Dev Box) <amankhalid@microsoft.com>

* .NET 10 P5 - Languages (#9916)

* update csharp

* Add C# features in preview 5

Write the description for user defined compound assignment operators.

* Remove VB release notes for P5

There aren't notable new features in Visual Basic for Preview 5.

* Update fsharp.md

* Update fsharp.md

* Update fsharp.md

* add vb back just to link to docs

* update f#

* Update README.md

---------

Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>

* updates for lint

* update (#9915)

* update for sdk (#9914)

* some more updates

* .NET MAUI in 10 Preview 5 (#9921)

* .NET MAUI in 10 Preview 5

* Update dotnetmaui.md

* added contributors

* hybridwebview interception

* addressing comments

---------

Co-authored-by: James Montemagno <james.montemagno@gmail.com>

* linting

* Update release-notes/10.0/preview/preview5/README.md

Co-authored-by: Martin Costello <martin@martincostello.com>

* Update release-notes/10.0/preview/preview5/README.md

Co-authored-by: Martin Costello <martin@martincostello.com>

* Update ef and date

* updating md file

* Added updates to README

---------

Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
Co-authored-by: Merrie McGaw <mmcgaw@microsoft.com>
Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com>
Co-authored-by: Aman Khalid (from Dev Box) <amankhalid@microsoft.com>
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>
Co-authored-by: David Ortinau <david.ortinau@microsoft.com>
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: victorisr <victorisr@microsoft.com>
2025-06-10 09:57:27 -07:00

6.4 KiB

.NET MAUI in .NET 10 Preview 5 - Release Notes

Here's a summary of what's new in .NET MAUI, .NET for Android, and .NET for iOS, Mac Catalyst, macOS, and tvOS in this preview release:

.NET MAUI updates in .NET 10:

XAML Global Namespaces

In your projects you can now glob together XML-namespaces into a new global namespace xmlns="http://schemas.microsoft.com/dotnet/maui/global", and use them without prefixes. The .NET MAUI namespace is included already.

By convention the new project template creates a file GlobalXmlns.cs.

[assembly: XmlnsDefinition(
    "http://schemas.microsoft.com/dotnet/maui/global",
    "MyApp.Views")]
[assembly: XmlnsDefinition(
    "http://schemas.microsoft.com/dotnet/maui/global",
    "MyApp.Controls")]
[assembly: XmlnsDefinition(
    "http://schemas.microsoft.com/dotnet/maui/global",
    "MyApp.Converters")]
[assembly: XmlnsDefinition(
    "http://schemas.microsoft.com/dotnet/maui/global",
    "http://schemas.syncfusion.com/maui/toolkit")]

You can then use anything in those namespaces like you do .NET MAUI controls, without prefix.

<ContentPage 
    xmlns="http://schemas.microsoft.com/dotnet/maui/global"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="MyApp.MainPage">
    <TagView x:DataType="Tag" />
</ContentPage>

The x namespace cannot be globbed into the global namespace since it's used for parsing.

XAML Implicit Namespaces

You can opt-in to this feature by adding the following to your project file. As of now, turning this on may cause errors to be reported by various XAML tools.

<PropertyGroup>
  <DefineConstants>$(DefineConstants);MauiAllowImplicitXmlnsDeclaration</DefineConstants>
  <EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

With this change you can also eliminate xmlns and xmlns:x from XAML files.

<ContentPage x:Class="MyApp.MainPage">
    <TagView x:DataType="Tag" />
</ContentPage>

In this usage:

  • the default xmlns is the global one
  • the x: prefix is added by default
  • all xmlns with a XmlnsPrefix are also accessible with their prefix, even if they are included in the global xmlns. These are useful for disambiguating a name. For example, the maui: prefix points to the maui xmlns.
  • you still need to use the x: prefix (e.g. x:Class, x:DataType), but you don't have to declare it

Intercept Web Requests

The HybridWebView now allows you to intercept when the browser requests a web resource in order to take action before it executes, such as adding a header to the request. The do this, add a listener to the WebResourceRequested event.

<HybridWebView WebResourceRequested="HybridWebView_WebResourceRequested" />
private void HybridWebView_WebResourceRequested(object sender, HybridWebViewWebResourceRequestedEventArgs e)
{
  // NOTES:
  // * This method MUST be synchronous, as it is called from the WebView's thread.
  // * This method MUST return a response (even if it is not yet complete), otherwise the 
  //   WebView may freeze or return a error response.
  // * The response must be set using the SetResponse method of the event args.

  // Only handle requests for the specific image URL
  if (!e.Uri.ToString().Contains("sample-image.png"))
    return;

  // Prevent the default behavior of the web view
  e.Handled = true;

  // Return the stream or task of stream that contains the content
  // NOTE: the method is NOT awaited, the WebView will continue to load the content
  e.SetResponse(200, "OK", "image/png", GetStreamAsync());
  }

.NET for Android

This release was focused on quality improvements. A detailed list can be found on dotnet/android GitHub releases.

.NET for iOS, Mac Catalyst, macOS, tvOS

This release was focused on quality improvements. A detailed list can be found on dotnet/macios GitHub releases including a list of Known issues.

Contributors

Thank you contributors! ❤️

@Ahamed-Ali, @Dhivya-SF4094, @HarishKumarSF4517, @KarthikRajaKalaimani, @LogishaSelvarajSF4525, @MartyIX, @NafeelaNazhir, @NanthiniMahalingam, @NirmalKumarYuvaraj, @PaulAndersonS, @PureWeen, @Shalini-Ashokan, @StephaneDelcroix, @SubhikshaSf4851, @SuthiYuvaraj, @SyedAbdulAzeemSF4852, @Tamilarasan-Paranthaman, @TamilarasanSF4853, @Vignesh-SF3580, @anandhan-rajagopal, @bhavanesh2001, @corvinsz, @devanathan-vaithiyanathan, @drasticactions, @jfversluis, @jonathanpeppers, @jsuarezruiz, @kubaflo, @mattleibow, @moljac, @nivetha-nagalingam, @pjcollins, @prakashKannanSf3972, @praveenkumarkarunanithi, @rmarinho, @simonrozsival, @tj-devel709