diff --git a/aspnetcore/blazor/components/virtualization.md b/aspnetcore/blazor/components/virtualization.md index 3412f3f6759a..a1883604c19b 100644 --- a/aspnetcore/blazor/components/virtualization.md +++ b/aspnetcore/blazor/components/virtualization.md @@ -279,11 +279,11 @@ The com ## Scroll to a specific item -The component provides two ways to control scroll position: `InitialIndex` for the first render and `ScrollToIndexAsync` for programmatic scrolling after the component is rendered. +The component provides two ways to control scroll position: `InitialItemIndex` for the first render and `ScrollToIndexAsync` for programmatic scrolling after the component is rendered. -### `InitialIndex` parameter +### `InitialItemIndex` parameter -Set `InitialIndex` to open the list at a specific item index on the first interactive render. This is a one-shot parameter—changes after first render are ignored. Out-of-range values are clamped. +Set `InitialItemIndex` to open the list at a specific item index on the first interactive render. This is a one-shot parameter—changes after first render are ignored. Out-of-range values are clamped. ```razor diff --git a/aspnetcore/blazor/forms/validation.md b/aspnetcore/blazor/forms/validation.md index 526b175a0084..101f1d1f41b8 100644 --- a/aspnetcore/blazor/forms/validation.md +++ b/aspnetcore/blazor/forms/validation.md @@ -5,7 +5,7 @@ author: guardrex description: Learn how to use validation in Blazor forms. monikerRange: '>= aspnetcore-3.1' ms.author: wpickett -ms.date: 11/25/2025 +ms.date: 08/11/2026 uid: blazor/forms/validation --- # ASP.NET Core Blazor forms validation @@ -2460,7 +2460,7 @@ To opt into the nested objects and collection types validation feature: 1. Call the extension method in the `Program` file where services are registered. 2. Declare the form model types in a C# class file, not in a Razor component (`.razor`). -3. Annotate the root form model type with the [`[ValidatableType]` attribute](xref:Microsoft.Extensions.Validation.ValidatableTypeAttribute). +3. Annotate the root form model type with the [`[ValidatableType]` attribute](xref:Microsoft.Extensions.Validation.ValidatableTypeAttribute), which indicates that a type is validatable to support discovery by the validation source generator. The following example demonstrates customer orders with nested collection form validation. @@ -2713,7 +2713,7 @@ namespace Microsoft.Extensions.Validation.Embedded Use the exact namespace (`Microsoft.Extensions.Validation.Embedded`) and class name (`ValidatableTypeAttribute`) in order for the validation source generator to detect and use the type. You can declare a global `using` statement for the namespace, either with a `global using Microsoft.Extensions.Validation.Embedded;` statement or with a `` item in the library's project file. -Whichever approach is adopted, denote the presence of the workaround for a future update to your code when the app can target .NET 11 or later. At that time, you can remove your workarounds from the app. +Whichever approach is adopted, denote the presence of the workaround for a future update to your code when the app can target .NET 11 or later. At that time, you can remove your workarounds from the app. :::moniker-end diff --git a/aspnetcore/release-notes/aspnetcore-11/includes/blazor.md b/aspnetcore/release-notes/aspnetcore-11/includes/blazor.md index 262ebcd6e0e2..a1fed81eb30b 100644 --- a/aspnetcore/release-notes/aspnetcore-11/includes/blazor.md +++ b/aspnetcore/release-notes/aspnetcore-11/includes/blazor.md @@ -155,13 +155,13 @@ For more information, see the following resources: * Use the new `AnchorMode` parameter to control how the viewport behaves at list edges when items are dynamically added: * `None`: No edge pinning. The viewport stays at the current scroll position regardless of item changes. - * `Beginning`: Pins the viewport to the beginning of the list. For example, this pinning behavior is useful for a news feed user experience. + * `Start` (default): Pins the viewport to the beginning of the list. For example, this pinning behavior is useful for a news feed user experience. * `End`: Pins the viewport to the end of the list. For example, this pinning behavior is useful for a chat or logging user experience. In the following example, the virtualized content is pinned to the beginning of the list: ```razor - + ... ``` @@ -809,9 +809,9 @@ For more information, see the following resources: General coverage for the new automatic CSRF protection in ASP.NET Core: -* -* -* +* +* +* ### Blazor Virtualize can scroll to an item @@ -819,11 +819,11 @@ General coverage for the new automatic CSRF protection in ASP.NET Core: The `Virtualize` component can now open at a specific item and scroll to any item on demand. Two new public APIs make this possible: -* `InitialIndex` positions the list at a given item on the first interactive render, so the list opens at that item without a flash of the first item. +* `InitialItemIndex` positions the list at a given item on the first interactive render, so the list opens at that item without a flash of the first item. * `ScrollToIndexAsync(int itemIndex, CancellationToken cancellationToken = default)` scrolls to an item at any time after the first render and returns a `Task` that completes when the target is aligned to the top of the viewport. ```razor - +
@context.Name
@@ -837,6 +837,45 @@ The `Virtualize` component can now open at a specific item and scroll to } ``` -Out-of-range indexes are clamped to the valid range. If a second `ScrollToIndexAsync` call starts while one is still in flight, the last call wins. Calling `ScrollToIndexAsync` before the first interactive render throws `InvalidOperationException`; use `InitialIndex` to set the starting position instead. +Out-of-range indexes are clamped to the valid range. If a second `ScrollToIndexAsync` call starts while one is still in flight, the last call wins. Calling `ScrollToIndexAsync` before the first interactive render throws `InvalidOperationException`; use `InitialItemIndex` to set the starting position instead. -For more information, see [Add `InitialIndex` parameter and `ScrollToIndexAsync` API to `Virtualize` (`dotnet/aspnetcore` #66753)](https://github.com/dotnet/aspnetcore/pull/66753). (Please don't comment on closed issues and PRs.) +For more information, see [Add `InitialIndex` (sic) parameter and `ScrollToIndexAsync` API to `Virtualize` (`dotnet/aspnetcore` #66753)](https://github.com/dotnet/aspnetcore/pull/66753). (Please don't comment on closed issues and PRs.) + +### Automatic circuit pause on tab inactivity + +Auto-pause can pause a circuit when the browser tab becomes hidden, freeing server memory and SignalR connections held by inactive users. It's an opt-in feature provided by the `Microsoft.AspNetCore.Components.Server.AutoPause` package. After adding a package reference, enable the feature by calling `AddAutoPause` when the app's root component is mapped: + +```csharp +app.MapRazorComponents() + .WithBrowserOptions(options => options.AddAutoPause(p => p.HiddenDelay = TimeSpan.FromSeconds(30))); +``` + +After the tab is hidden for a configurable delay period (default: 2 minutes), the circuit pauses. If the user returns before the delay elapses, the pause doesn't occur. + +For more information, see . + +### Wider support for `AuthorizationPolicy` and `IAuthorizationRequirementData` + +Starting in .NET 11, you can apply attributes to SignalR hubs and hub methods, MVC controllers and actions, and Blazor's [`AuthorizeView`](xref:blazor/security/index#authorizeview-component) and [`AuthorizeRouteView`](xref:blazor/security/authentication-state?pivots=server#implement-a-custom-authenticationstateprovider) components, not just to endpoints. For apps that target releases earlier than .NET 11, these attributes are only enforced on Minimal API and routed endpoints. + +For more information, see . + +### QuickGrid APIs from Virtualize are exposed + +The following new [`QuickGrid` component](xref:Microsoft.AspNetCore.Components.QuickGrid) APIs are exposed when a grid is virtualized ( set to `true`): + +* `InitialItemIndex`: Scrolls the grid to the given zero-based row index on the first interactive render. The value is applied once and clamped to the valid range. This forwards to the inner `Virtualize` component. For more information, see . +* `ScrollToItemAsync`: Programmatically scrolls the grid to the given zero-based row index, aligning it to the top. The last call wins, and the method throws an when virtualization is disabled or the grid isn't rendered yet. This forwards to the inner `Virtualize` component. For more information, see . +* `AnchorMode`: Controls how the viewport behaves at list edges when items are dynamically added (default: `Start`). This is an experimental API that requires opting in to the `ASP0030` diagnostic, and it forwards to the inner `Virtualize` component. For more information, see . +* `ItemComparer`: A comparer used to detect whether items were prepended or appended between data loads, which is useful for class-typed items supplied by an . This is an experimental API that requires opting in to the `ASP0030` diagnostic, and it forwards to the inner `Virtualize` component. For more information, see . + +For more information, see . + +### `ValidatableTypeAttribute` and `SkipValidationAttribute` are no longer experimental + +The and attributes from the [`Microsoft.Extensions.Validation` NuGet package](https://www.nuget.org/packages/Microsoft.Extensions.Validation) are no longer experimental. + +For more information, see the following resources: + +* +*