From 92121c2ecc68dacfa8c4855726f93a18461b6bb4 Mon Sep 17 00:00:00 2001 From: David Britch Date: Mon, 2 Oct 2023 09:30:40 +0100 Subject: [PATCH 01/77] Support versioning. --- .openpublishing.publish.config.json | 1 + docs/docfx.json | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.openpublishing.publish.config.json b/.openpublishing.publish.config.json index 589c2f746b..36a9f2e251 100644 --- a/.openpublishing.publish.config.json +++ b/.openpublishing.publish.config.json @@ -7,6 +7,7 @@ "locale": "en-us", "monikers": [], "moniker_ranges": [ + ">=net-maui-7.0" ], "open_to_public_contributors": true, "xref_query_tags": [ diff --git a/docs/docfx.json b/docs/docfx.json index 785a174cd3..1657f70097 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -70,7 +70,8 @@ "markdownEngineName": "markdig", "groups": { "net": { - "dest": "net-dest" + "dest": "net-dest", + "moniker_range": ">=net-maui7.0" } } } From cb33f0fceceab7098d83306e1e702976816f2737 Mon Sep 17 00:00:00 2001 From: David Britch Date: Mon, 2 Oct 2023 09:37:40 +0100 Subject: [PATCH 02/77] Fix moniker. --- docs/docfx.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docfx.json b/docs/docfx.json index 1657f70097..658e8d1115 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -71,7 +71,7 @@ "groups": { "net": { "dest": "net-dest", - "moniker_range": ">=net-maui7.0" + "moniker_range": ">=net-maui-7.0" } } } From e8ec4f31f61b6eb64ac6b32df2bd64dcece5a9b5 Mon Sep 17 00:00:00 2001 From: David Britch Date: Mon, 2 Oct 2023 09:46:31 +0100 Subject: [PATCH 03/77] Add StartPath property. --- docs/user-interface/controls/blazorwebview.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/user-interface/controls/blazorwebview.md b/docs/user-interface/controls/blazorwebview.md index b182e31d64..86a7b793a3 100644 --- a/docs/user-interface/controls/blazorwebview.md +++ b/docs/user-interface/controls/blazorwebview.md @@ -1,7 +1,7 @@ --- title: "Host a Blazor web app in a .NET MAUI app using BlazorWebView" description: "The .NET MAUI BlazorWebView control enables you to host a Blazor web app in your .NET MAUI app, and integrate the app with device features." -ms.date: 01/18/2023 +ms.date: 10/02/2023 --- # Host a Blazor web app in a .NET MAUI app using BlazorWebView @@ -10,9 +10,21 @@ The .NET Multi-platform App UI (.NET MAUI) defines the following properties: +::: moniker range="=net-maui-7.0" + - `HostPage`, of type `string?`, which defines the root page of the Blazor web app. - `RootComponents`, of type `RootComponentsCollection`, which specifies the collection of root components that can be added to the control. +::: moniker-end + +::: moniker range="=net-maui-8.0" + +- `HostPage`, of type `string?`, which defines the root page of the Blazor web app. +- `RootComponents`, of type `RootComponentsCollection`, which specifies the collection of root components that can be added to the control. +- `StartPath`, of type `string`, which defines the path for initial navigation within the Blazor navigation context when the Blazor component is finished loading. + +::: moniker-end + The `RootComponent` class defines the following properties: - `Selector`, of type `string?`, which defines the CSS selector string that specifies where in the document the component should be placed. From 7382b5a6af8d342d1795b9cffd909a23bd048ccf Mon Sep 17 00:00:00 2001 From: David Britch Date: Mon, 2 Oct 2023 10:07:16 +0100 Subject: [PATCH 04/77] TryDispatchAsync on BlazorWebView --- docs/user-interface/controls/blazorwebview.md | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/user-interface/controls/blazorwebview.md b/docs/user-interface/controls/blazorwebview.md index 86a7b793a3..f833fbb0ad 100644 --- a/docs/user-interface/controls/blazorwebview.md +++ b/docs/user-interface/controls/blazorwebview.md @@ -17,7 +17,7 @@ The .NET Multi-platform App UI (.NET MAUI) has a `TryDispatchAsync` method that calls a specified `Action` asynchronously and passes in the scoped services available in Razor components. This enables code from the native UI to access scoped services such as `NavigationManager`: + +```csharp +private async void MyMauiButtonHandler(object sender, EventArgs e) +{ + var wasDispatchCalled = await _blazorWebView.TryDispatchAsync(sp => + { + var navMan = sp.GetRequiredService(); + navMan.CallSomeNavigationApi(...); + }); + + if (!wasDispatchCalled) + { + // Consider what to do if it wasn't called - that's up to your app to decide + } +} +``` + +::: moniker-end From 5689ec734efa273d3158aa03bd0b58ef1a8ce286 Mon Sep 17 00:00:00 2001 From: David Britch Date: Mon, 2 Oct 2023 10:54:02 +0100 Subject: [PATCH 05/77] Diagnosing BlazorWebView issues (#1747) * Enable logging in Blazor Hybrid apps. * What's new in .NET 8. * Fix linting errors. * Add heading. * Add xref. --- docs/troubleshooting.md | 11 +++- docs/user-interface/controls/blazorwebview.md | 49 +++++++++++++- docs/whats-new/TOC.yml | 2 + docs/whats-new/dotnet-8.md | 65 +++++++++++++++++++ 4 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 docs/whats-new/dotnet-8.md diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 19e5fd9d1d..0d1587f028 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -1,7 +1,7 @@ --- title: "Troubleshoot known issues" description: "Learn about .NET MAUI known issues and troubleshooting you can do to resolve these issues." -ms.date: 03/08/2023 +ms.date: 10/02/2023 --- # Troubleshooting known issues @@ -182,3 +182,12 @@ If you receive the error "Could not find a valid Xcode app bundle at '/Library/D ```zsh sudo xcode-select --reset ``` + +## Diagnose issues in Blazor Hybrid apps + + has built-in logging that can help you diagnose problems in your Blazor Hybrid app. There are two steps to enable this logging: + +1. Enable and related components to log diagnostic information. +1. Configure a logger to write the log output to where you can view it. + +For more information, see [Diagnosing issues in Blazor Hybrid apps](~/user-interface/controls/blazorwebview.md#diagnosing-issues). diff --git a/docs/user-interface/controls/blazorwebview.md b/docs/user-interface/controls/blazorwebview.md index f833fbb0ad..97014d4146 100644 --- a/docs/user-interface/controls/blazorwebview.md +++ b/docs/user-interface/controls/blazorwebview.md @@ -138,7 +138,7 @@ The process to add a has a `TryDispatchAsync` method that calls a specified `Action` asynchronously and passes in the scoped services available in Razor components. This enables code from the native UI to access scoped services such as `NavigationManager`: + has a `TryDispatchAsync` method that can call a specified `Action` asynchronously and pass in the scoped services available in Razor components. This enables code from the native UI to access scoped services such as `NavigationManager`: ```csharp private async void MyMauiButtonHandler(object sender, EventArgs e) @@ -156,4 +156,51 @@ private async void MyMauiButtonHandler(object sender, EventArgs e) } ``` +## Diagnosing issues + + has built-in logging that can help you diagnose issues in your Blazor Hybrid app. There are two steps to enable this logging: + +1. Enable and related components to log diagnostic information. +1. Configure a logger to write the log output to where you can view it. + +For more information about logging, see [Logging in C# and .NET](/dotnet/core/extensions/logging). + +### Enable BlazorWebView logging + +All logging configuration can be performed as part of service registration in the dependency injection system. To enable maximum logging for and related components under the `Microsoft.AspNetCore.Components.WebView` namespace, add the following code to where your app's services are registered: + +```csharp +services.AddLogging(logging => +{ + logging.AddFilter("Microsoft.AspNetCore.Components.WebView", LogLevel.Trace); +}); +``` + +Alternatively, to enable maximum logging for every component that uses `Microsoft.Extensions.Logging`, you could use the following code: + +```csharp +services.AddLogging(logging => +{ + logging.SetMinimumLevel(LogLevel.Trace); +}); +``` + +### Configure logging output and viewing the output + +After configuring components to write log information you need to configure where the loggers should write the logs to, and then view the log output. + +The **Debug** logging providers write the output using `Debug` statements, and the output can be viewed from Visual Studio. + +To configure the **Debug** logging provider, first add a reference in your project to the `Microsoft.Extensions.Logging.Debug` NuGet package. Then register the provider inside the call to `AddLogging` that you added in the previous step by calling the `AddDebug` extension method: + +```csharp +services.AddLogging(logging => +{ + logging.AddFilter("Microsoft.AspNetCore.Components.WebView", LogLevel.Trace); + logging.AddDebug(); +}); +``` + +When you run the app from Visual Studio (with debugging enabled), you can view the debug output in Visual Studio's **Output** window. + ::: moniker-end diff --git a/docs/whats-new/TOC.yml b/docs/whats-new/TOC.yml index 19ba98ad08..656e42fe91 100644 --- a/docs/whats-new/TOC.yml +++ b/docs/whats-new/TOC.yml @@ -6,6 +6,8 @@ items: - name: Releases expanded: true items: + - name: .NET 8 + href: dotnet-8.md - name: .NET 7 href: dotnet-7.md - name: Month diff --git a/docs/whats-new/dotnet-8.md b/docs/whats-new/dotnet-8.md new file mode 100644 index 0000000000..24431deb83 --- /dev/null +++ b/docs/whats-new/dotnet-8.md @@ -0,0 +1,65 @@ +--- +title: What's new in .NET MAUI for .NET 8 +description: Learn about the new features introduced in .NET MAUI for .NET 8. +ms.date: 10/02/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](https://dotnet.microsoft.com/platform/support/policy/maui). For more information, see [.NET MAUI support policy](https://dotnet.microsoft.com/platform/support/policy/maui). + +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](/dotnet/core/whats-new/dotnet-8). + +## New functionality + +.NET MAUI for .NET 8 addresses top feedback issues and introduces the following new functionality: + +- 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](~/user-interface/controls/blazorwebview.md). + + + + + + + + From 48d3c9280118b7a95cf7eae0a89cbda53a0dd5bf Mon Sep 17 00:00:00 2001 From: David Britch Date: Mon, 2 Oct 2023 11:38:39 +0100 Subject: [PATCH 06/77] New PointerGestureRecognizer commands and events (#1749) * New PointerGestureRecognizer commands and events. * What's new edit. --- docs/fundamentals/gestures/pointer.md | 35 ++++++++++++++++++++++++++- docs/whats-new/dotnet-8.md | 1 + 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/fundamentals/gestures/pointer.md b/docs/fundamentals/gestures/pointer.md index 56e85f265e..185f54c764 100644 --- a/docs/fundamentals/gestures/pointer.md +++ b/docs/fundamentals/gestures/pointer.md @@ -1,28 +1,61 @@ --- title: "Recognize a pointer gesture" description: "Learn how to use the PointerGestureRecognizer class, to detect when the pointer enters, exits, and moves within a view on iPadOS, Mac Catalyst, and Windows." -ms.date: 10/24/2022 +ms.date: 10/02/2023 --- # Recognize a pointer gesture A .NET Multi-platform App UI (.NET MAUI) pointer gesture recognizer detects when the pointer enters, exits, and moves within a view and is implemented with the class. This class defines the following properties: +::: moniker range="=net-maui-7.0" + +- , of type `ICommand`, which is the command to invoke when the pointer enters the bounding area of the view. +- , of type `object`, which is the parameter that's passed to . +- , of type `ICommand`, which is the command to invoke when the pointer that's in the view's bounding area leaves that bounding area. +- , of type `object`, which is the parameter that's passed to . +- , of type `ICommand`, which is the command to invoke when the pointer moves while remaining within the bounding area of the view. +- , of type `object`, which is the parameter that's passed to . + +::: moniker-end + +::: moniker range=">=net-maui-8.0" + - , of type `ICommand`, which is the command to invoke when the pointer enters the bounding area of the view. - , of type `object`, which is the parameter that's passed to . - , of type `ICommand`, which is the command to invoke when the pointer that's in the view's bounding area leaves that bounding area. - , of type `object`, which is the parameter that's passed to . - , of type `ICommand`, which is the command to invoke when the pointer moves while remaining within the bounding area of the view. - , of type `object`, which is the parameter that's passed to . +- `PointerPressedCommand`, of type `ICommand`, which is the command to invoke when the pointer initiates a press within the view. +- `PointerPressedCommandParameter`, of type `object`, which is the parameter that's passed to the `PointerPressedCommand`. +- `PointerReleasedCommand`, of type `ICommand`, which is the command to invoke when the pointer that has previously initiated a press is released, while within the view. +- `PointerReleasedCommandParameter`, of type `object`, which is the parameter that's passed to the `PointerReleasedCommand`. + +::: moniker-end These properties are backed by objects, which means that they can be targets of data bindings, and styled. The class also defines the following events: +::: moniker range="=net-maui-7.0" + - , that's raised when the pointer enters the bounding area of the view. - , that's raised when the pointer that's in the view's bounding area leaves that bounding area. - , that's raised when the pointer moves while remaining within the bounding area of the view. +::: moniker-end + +::: moniker range=">=net-maui-8.0" + +- , that's raised when the pointer enters the bounding area of the view. +- , that's raised when the pointer that's in the view's bounding area leaves that bounding area. +- , that's raised when the pointer moves while remaining within the bounding area of the view. +- `PointerPressed`, that's raised when the pointer initiates a press within the view. +- `PointerReleased`, that's raised when the pointer that has previously initiated a press is released, while within the view. + +::: moniker-end + A object accompanies all three events, and defines a `GetPosition` method that returns a `Point?` object that represents the position of the pointer when the gesture was detected. For more information about the `GetPosition` method, see [Get the gesture position](#get-the-gesture-position). > [!IMPORTANT] diff --git a/docs/whats-new/dotnet-8.md b/docs/whats-new/dotnet-8.md index 24431deb83..a820884d29 100644 --- a/docs/whats-new/dotnet-8.md +++ b/docs/whats-new/dotnet-8.md @@ -17,6 +17,7 @@ For information about what's new in .NET 8, see [What's new in .NET 8](/dotnet/c .NET MAUI for .NET 8 addresses top feedback issues and introduces the following new functionality: - 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](~/user-interface/controls/blazorwebview.md). +- gains `PointerPressedCommand`, `PointerPressedCommandParameter`, `PointerReleasedCommand`, `PointerReleasedCommandParameter` properties, and `PointerPressed` and `PointerReleased` events. For more information, see [Recognize a pointer gesture](~/fundamentals/gestures/pointer.md). +Many classes also have [`ContentProperty`](xref:Microsoft.Maui.Controls.ContentPropertyAttribute) attribute definitions. For example, the content property of is `Text`. ## Platform differences diff --git a/docs/xaml/markup-extensions/consume.md b/docs/xaml/markup-extensions/consume.md index 1545b1fafa..241fc01012 100644 --- a/docs/xaml/markup-extensions/consume.md +++ b/docs/xaml/markup-extensions/consume.md @@ -101,7 +101,7 @@ Just as you can abbreviate `x:StaticExtension` to `x:Static` when you use it as FontSize="{x:Static Member=local:AppConstants.NormalFontSize}" /> ``` -The class has a `ContentProperty` attribute referencing the property `Member`, which marks this property as the class's default content property. For XAML markup extensions expressed with curly braces, you can eliminate the `Member=` part of the expression: +The class has a [`ContentProperty`](xref:Microsoft.Maui.Controls.ContentPropertyAttribute) attribute referencing the property `Member`, which marks this property as the class's default content property. For XAML markup extensions expressed with curly braces, you can eliminate the `Member=` part of the expression: ```xaml