Skip to content

Latest commit

 

History

History
94 lines (70 loc) · 11.4 KB

dotnet-8.md

File metadata and controls

94 lines (70 loc) · 11.4 KB
title description ms.date
What's new in .NET MAUI for .NET 8
Learn about the new features introduced in .NET MAUI for .NET 8.
10/10/2023

What's new in .NET MAUI for .NET 8

.NET 8 is the successor to .NET 7 and focuses on being unified, modern, simple, and fast. Due to working with underlying external dependencies, such as Xcode or Android SDK Tools, the .NET Multi-platform App UI (.NET MAUI) support policy differs from the .NET and .NET Core support policy. For more information, see .NET MAUI support policy.

This article lists the new features of .NET MAUI for .NET 8 and provides links to more detailed information on each.

For information about what's new in .NET 8, see What's new in .NET 8.

New functionality

.NET MAUI for .NET 8 addresses top feedback issues and introduces the following new functionality:

  • xref:Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebView gains a StartPath property, a TryDispatchAsync method, and enhanced logging capabilities. For more information, see Host a Blazor web app in a .NET MAUI app using BlazorWebView.
  • xref:Microsoft.Maui.Controls.PointerGestureRecognizer gains PointerPressedCommand, PointerPressedCommandParameter, PointerReleasedCommand, PointerReleasedCommandParameter properties, and PointerPressed and PointerReleased events. For more information, see Recognize a pointer gesture.
  • xref:Microsoft.Maui.Devices.Flashlight gains a IsSupportedAsync method that determines whether a flashlight is available on the device. For more information, see Flashlight.
  • xref:Microsoft.Maui.Devices.Sensors.SensorSpeed intervals have been unified across all platforms. For more information, see Accessing device sensors.
  • xref:Microsoft.Maui.Controls.SolidColorBrush.Color is the ContentProperty of the xref:Microsoft.Maui.Controls.SolidColorBrush class, and therefore does not need to be explicitly set from XAML.
  • The position at which a drag or drop gesture occurred can be obtained by calling the GetPosition method on a xref:Microsoft.Maui.Controls.DragEventArgs, xref:Microsoft.Maui.Controls.DragStartingEventArgs, or xref:Microsoft.Maui.Controls.DropEventArgs object. For more information, see Recognize a drag and drop gesture.
  • xref:Microsoft.Maui.Controls.WebView gains a UserAgent property. For more information, see WebView.
  • Inline media playback of HTML5 video, including autoplay and picture in picture, has been enabled by default for the xref:Microsoft.Maui.Controls.WebView on iOS. For more information, see Set media playback preferences on iOS and Mac Catalyst.
  • Resources defined in a xref:Microsoft.Maui.Controls.ResourceDictionary can also be consumed in an AppThemeBinding with the DynamicResource markup extension. For more information, see Define and consume theme resources.
  • The Grid.Add overload that accepts 5 arguments has been added back to .NET MAUI. However, this method is deprecated and is only present to aid migrations from Xamarin.Forms.
  • xref:Microsoft.Maui.Controls.Grid gains an AddWithSpan extension method that adds a view to the Grid at the specified row and column with the specified row and column spans.
  • On iOS, MauiUIApplicationDelegate gains a PerformFetch method that can be overridden or consumed via the iOSLifecycle.PerformFetch delegate. For more information, see iOS platform lifecycle events.
  • The xref:Microsoft.Maui.Controls.TapGestureRecognizer class gains the ability to handle secondary taps on Android. For more information, see Recognize a tap gesture.
  • The xref:Microsoft.Maui.Controls.PointerEventArgs object that accompanies the pointer events raised by the xref:Microsoft.Maui.Controls.PointerGestureRecognizer class gains a PlatformArgs property of type PlatformPointerEventArgs. This property provides access to the platform-specific arguments for a pointer gesture event. For more information, see Recognize a pointer gesture.
  • The xref:Microsoft.Maui.Controls.DragStartingEventArgs, xref:Microsoft.Maui.Controls.DragEventArgs, xref:Microsoft.Maui.Controls.DropEventArgs, and xref:Microsoft.Maui.Controls.DropCompletedEventArgs objects that accompany drag and drop gesture events each gain a PlatformArgs property. This property provides access to the platform-specific arguments for a drag or drop event. For more information, see Recognize a drag and drop gesture.
  • For troubleshooting purposes, resource generation can be disabled. For more information, see Disable image packaging, Disable splash screen packaging, Disable font packaging, and Disable asset file packaging.
  • For troubleshooting purposes, a blank splash screen can be generated. For more information, see Generate a blank splash screen.
  • Resizeter checks for duplicate image filenames. For more information, see Duplicate image filename errors.
  • Controls that support text input gain extension methods that support hiding and showing the soft input keyboard. For more information, see Hide and show the soft input keyboard.
  • The x:ClassModifier attribute can be specified on XAML classes, to control the access level for a generated class in an assembly. For more information, see Class modifiers.
  • The xref:Microsoft.Maui.ApplicationModel.Permissions class gains the Bluetooth permission, which is an Android 12 permission for looking for Bluetooth devices, making the current device discoverable to other Bluetooth devices, and communicating with already-paired Bluetooth devices. For more information, see Permissions.
  • The xref:Microsoft.Maui.ApplicationModel.Permissions class gains the NearbyWifiDevices permission, which is an Android 13 permission for accessing nearby WiFi devices. For more information, see Permissions.
  • Several system fonts can be easily consumed in Android apps. For more information, see Consume fonts.
  • Shell navigation gains a GoToAsync overload that enables you to pass single use navigation data, that's cleared after navigation has occurred, as a ShellNavigationQueryParameters object. For more information, see Pass data.

The following types or members have been deprecated:

  • xref:Microsoft.Maui.Controls.ClickGestureRecognizer has been deprecated.
  • The AutomationProperties.Name, AutomationProperties.HelpText, and AutomationProperties.LabeledBy attached properties have been deprecated.
  • The xref:Microsoft.Maui.Controls.VisualElement.FocusChangeRequested has been deprecated. Instead, use the xref:Microsoft.Maui.IView.Focus method to attempt to set focus on the view.

The following types or members have been removed:

The following behavior has changed from the previous release:

  • Use of the xref:Microsoft.Maui.Controls.Maps.Map control from XAML now requires the following xmlns namespace declaration: xmlns:maps="http://schemas.microsoft.com/dotnet/2021/maui/maps".
  • Image caching is disabled on Android when loading an image from a stream with the ImageSource.FromStream method. This is due to the lack of data from which to create a reasonable cache key.
  • On iOS, pages automatically scroll when the soft input keyboard would cover a text entry field, so that the field is above the soft input keyboard. The KeyboardAutoManagerScroll.Disconnect method, in the Microsoft.Maui.Platform namespace, can be called to disable this default behavior. The KeyboardAutoManagerScroll.Connect method can be called to re-enable the behavior after it's been disabled.
  • The project templates include the com.apple.security.get-task-allow entitlement for debug builds on Mac Catalyst, so that you can use Safari developer tools to inspect the contents of a xref:Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebView and a xref:Microsoft.Maui.Controls.WebView on Mac Catalyst.