+ Rocket Lab is a registered trademark of + Rocket Lab USA Inc.. +
+``` + +`Shared/SpaceX.razor`: + +```razor ++ SpaceX is a registered trademark of + Space Exploration Technologies Corp.. +
+``` + +`Shared/UnitedLaunchAlliance.razor`: + +```razor ++ United Launch Alliance and ULA are registered trademarks of + United Launch Alliance, LLC. +
+``` + +`Shared/VirginGalactic.razor`: + +```razor ++ Virgin Galactic is a registered trademark of + Galactic Enterprises, LLC. +
+``` + +`Pages/DynamicComponentExample1.razor`: + +```razor +@page "/dynamiccomponent-example-1" +DynamicComponent Component Example 1+ +
+@if (selectedType is not null) +{ +DynamicComponent Component Example 2+ +
++ +
+@if (selectedType is not null) +{ ++ User selected a window seat: @WindowSeat +
++ Rocket Lab is a trademark of + Rocket Lab USA Inc.. +
+@code { + [Parameter] + public bool WindowSeat { get; set; } +} +``` + +## Avoid catch-all parameters + +Avoid the use of [catch-all parameters](xref:blazor/fundamentals/routing#catch-all-route-parameters). If catch-all parameters are used, every explicit parameter on `DynamicComponent` effectively is a reserved word that you can't pass to a dynamic child. Any new parameters passed to `DynamicComponent` are a breaking change, as they start shadowing child component parameters that happen to have the same name. It's unlikely that the caller always knows a fixed set of parameter names to pass to all possible dynamic children. + +## Trademarks + +Rocket Lab is a registered trademark of [Rocket Lab USA Inc.](https://www.rocketlabusa.com/). SpaceX is a registered trademark of [Space Exploration Technologies Corp.](https://www.spacex.com/). United Launch Alliance and ULA are registered trademarks of [United Launch Alliance, LLC](https://www.ulalaunch.com/). Virgin Galactic is a registered trademark of [Galactic Enterprises, LLC](https://www.virgingalactic.com/). diff --git a/aspnetcore/toc.yml b/aspnetcore/toc.yml index fc9999cafa4c..03c03964316b 100644 --- a/aspnetcore/toc.yml +++ b/aspnetcore/toc.yml @@ -368,6 +368,8 @@ uid: blazor/components/templated-components - name: CSS isolation uid: blazor/components/css-isolation + - name: Dynamically-rendered components + uid: blazor/components/dynamiccomponent - name: Prerender and integrate components uid: blazor/components/prerendering-and-integration - name: Class libraries From fc4c5d9408e92b0644ed05328a618169280b5068 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Mon, 9 Aug 2021 06:44:41 -0500 Subject: [PATCH 2/5] Updates --- aspnetcore/blazor/components/control-head-content.md | 2 +- aspnetcore/blazor/components/data-binding.md | 2 +- aspnetcore/blazor/components/dynamiccomponent.md | 2 ++ aspnetcore/blazor/forms-validation.md | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/aspnetcore/blazor/components/control-head-content.md b/aspnetcore/blazor/components/control-head-content.md index 2461de929ccd..3276ebcdb6a5 100644 --- a/aspnetcore/blazor/components/control-head-content.md +++ b/aspnetcore/blazor/components/control-head-content.md @@ -11,7 +11,7 @@ uid: blazor/components/control-head-content --- # Control `` content in ASP.NET Core Blazor apps -*This feature applies to ASP.NET Core 6.0 Preview 7 or later. ASP.NET Core 6.0 Preview 7 is scheduled for release in August, 2021. ASP.NET Core 6.0 is scheduled for release later this year.* +*This feature applies to ASP.NET Core 6.0 Preview 7 or later. ASP.NET Core 6.0 Preview 7 is scheduled for release in August. ASP.NET Core 6.0 is scheduled for release later this year.* Razor components can modify the HTML `` element content of a page, including setting the page's title (`Rocket Lab is a registered trademark of Rocket Lab USA Inc.. @@ -59,6 +61,7 @@ In the following example, a [Blazor form](xref:blazor/forms-validation) renders ```razor
SpaceX is a registered trademark of Space Exploration Technologies Corp.. @@ -69,6 +72,7 @@ In the following example, a [Blazor form](xref:blazor/forms-validation) renders ```razor
United Launch Alliance and ULA are registered trademarks of United Launch Alliance, LLC. @@ -79,6 +83,7 @@ In the following example, a [Blazor form](xref:blazor/forms-validation) renders ```razor
Virgin Galactic is a registered trademark of Galactic Enterprises, LLC. @@ -89,7 +94,9 @@ In the following example, a [Blazor form](xref:blazor/forms-validation) renders ```razor @page "/dynamiccomponent-example-1" +
DynamicComponent Component Example 1+ @if (selectedType is not null) {
DynamicComponent Component Example 2+
+ @if (selectedType is not null) {
User selected a window seat: @WindowSeat
+Rocket Lab is a trademark of Rocket Lab USA Inc..
+ @code { [Parameter] public bool WindowSeat { get; set; } @@ -256,4 +278,4 @@ Avoid the use of [catch-all parameters](xref:blazor/fundamentals/routing#catch-a ## Trademarks -Rocket Lab is a registered trademark of [Rocket Lab USA Inc.](https://www.rocketlabusa.com/). SpaceX is a registered trademark of [Space Exploration Technologies Corp.](https://www.spacex.com/). United Launch Alliance and ULA are registered trademarks of [United Launch Alliance, LLC](https://www.ulalaunch.com/). Virgin Galactic is a registered trademark of [Galactic Enterprises, LLC](https://www.virgingalactic.com/). +Rocket Lab is a registered trademark of [Rocket Lab USA Inc.](https://www.rocketlabusa.com/) SpaceX is a registered trademark of [Space Exploration Technologies Corp.](https://www.spacex.com/) United Launch Alliance and ULA are registered trademarks of [United Launch Alliance, LLC](https://www.ulalaunch.com/). Virgin Galactic is a registered trademark of [Galactic Enterprises, LLC](https://www.virgingalactic.com/). From aaa2da286cf6fdaa350ba93ccbc3b1b487940889 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Mon, 9 Aug 2021 09:18:27 -0500 Subject: [PATCH 5/5] Updates --- .../blazor/components/dynamiccomponent.md | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/aspnetcore/blazor/components/dynamiccomponent.md b/aspnetcore/blazor/components/dynamiccomponent.md index a3f9de372afd..088c9f1d7ebe 100644 --- a/aspnetcore/blazor/components/dynamiccomponent.md +++ b/aspnetcore/blazor/components/dynamiccomponent.md @@ -13,8 +13,6 @@ uid: blazor/components/dynamiccomponent By [Dave Brock](https://twitter.com/daveabrock) -*This feature applies to ASP.NET Core 6.0 Preview 7 or later. ASP.NET Core 6.0 Preview 7 is scheduled for release in August. ASP.NET Core 6.0 is scheduled for release later this year.* - Use the built-in `DynamicComponent` component to render components by type. A `DynamicComponent` is useful for rendering components without iterating through possible types or using conditional logic. For example, `DynamicComponent` can render a component based on a user selection from a dropdown list. @@ -37,14 +35,14 @@ For more information on passing parameter values, see the [Pass parameters](#pas ## Example -In the following example, a Razor component renders a component based on the user's selection from a dropdown list of four possible values. +In the following example, a Razor component renders a component based on the user's selection from a dropdown list of four possible values. -| User selection | Razor component to render… | -| -------------------- | ----------------------------------- | -| Rocket Lab® | `Shared/RocketLab.razor` | -| SpaceX® | `Shared/SpaceX.razor` | -| ULA® | `Shared/UnitedLaunchAlliance.razor` | -| Virgin Galactic® | `Shared/VirginGalactic.razor` | +| User spaceflight carrier selection | Shared Razor component to render | +| ---------------------------------- | ----------------------------------- | +| Rocket Lab® | `Shared/RocketLab.razor` | +| SpaceX® | `Shared/SpaceX.razor` | +| ULA® | `Shared/UnitedLaunchAlliance.razor` | +| Virgin Galactic® | `Shared/VirginGalactic.razor` | `Shared/RocketLab.razor`: @@ -53,7 +51,7 @@ In the following example, a Razor component renders a component based on the useRocket Lab is a registered trademark of - Rocket Lab USA Inc.. + Rocket Lab USA Inc.
``` @@ -64,7 +62,7 @@ In the following example, a Razor component renders a component based on the useSpaceX is a registered trademark of - Space Exploration Technologies Corp.. + Space Exploration Technologies Corp.
``` @@ -132,17 +130,12 @@ In the preceding example: * Component names are used as the option values using the [`nameof` operator](/dotnet/csharp/language-reference/operators/nameof), which returns component names as constant strings. * The `{APP NAMESPACE}` placeholder is the namespace of the app (for example, `BlazorSample`). -* The dynamically-rendered components are shared components in the app's `Shared` folder: - * `RocketLab` (`Shared/RocketLab.razor`) - * `SpaceX` (`Shared/SpaceX.razor`) - * `UnitedLaunchAlliance` (`Shared/UnitedLaunchAlliance.razor`) - * `VirginGalactic` (`Shared/VirginGalactic.razor`) ## Pass parameters If dynamically-rendered components have [component parameters](xref:blazor/components/index#component-parameters), pass them into the `DynamicComponent` as an `IDictionaryRocket Lab is a trademark of - Rocket Lab USA Inc.. + Rocket Lab USA Inc.
@code {