From 19f8294729710bb39a920ca31772f0b391552978 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Mon, 25 Oct 2021 04:22:43 -0500 Subject: [PATCH] Draw code from snippet sample apps (#23619) --- .../cascading-values-and-parameters.md | 32 +++---------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/aspnetcore/blazor/components/cascading-values-and-parameters.md b/aspnetcore/blazor/components/cascading-values-and-parameters.md index 855cda71d2..ff801f123b 100644 --- a/aspnetcore/blazor/components/cascading-values-and-parameters.md +++ b/aspnetcore/blazor/components/cascading-values-and-parameters.md @@ -28,15 +28,7 @@ The following `ThemeInfo` C# class is placed in a folder named `UIThemeClasses` `UIThemeClasses/ThemeInfo.cs`: -```csharp -namespace BlazorSample.UIThemeClasses -{ - public class ThemeInfo - { - public string ButtonClass { get; set; } - } -} -``` +[!code-csharp[](~/blazor/samples/6.0/BlazorSample_WebAssembly/UIThemeClasses/ThemeInfo.cs)] The following [layout component](xref:blazor/components/layouts) specifies theme information (`ThemeInfo`) as a cascading value for all components that make up the layout body of the property. `ButtonClass` is assigned a value of [`btn-success`](https://getbootstrap.com/docs/5.0/components/buttons/), which is a Bootstrap button style. Any descendent component in the component hierarchy can use the `ButtonClass` property through the `ThemeInfo` cascading value. @@ -85,7 +77,7 @@ In a descendant component, the cascaded parameters receive their cascaded values @code { [CascadingParameter(Name = "CascadeParam1")] protected CascadingType ChildCascadeParameter1 { get; set; } - + [CascadingParameter(Name = "CascadeParam2")] protected CascadingType ChildCascadeParameter2 { get; set; } } @@ -255,15 +247,7 @@ The following `ThemeInfo` C# class is placed in a folder named `UIThemeClasses` `UIThemeClasses/ThemeInfo.cs`: -```csharp -namespace BlazorSample.UIThemeClasses -{ - public class ThemeInfo - { - public string ButtonClass { get; set; } - } -} -``` +[!code-csharp[](~/blazor/samples/5.0/BlazorSample_WebAssembly/UIThemeClasses/ThemeInfo.cs)] The following [layout component](xref:blazor/components/layouts) specifies theme information (`ThemeInfo`) as a cascading value for all components that make up the layout body of the property. `ButtonClass` is assigned a value of [`btn-success`](https://getbootstrap.com/docs/5.0/components/buttons/), which is a Bootstrap button style. Any descendent component in the component hierarchy can use the `ButtonClass` property through the `ThemeInfo` cascading value. @@ -482,15 +466,7 @@ The following `ThemeInfo` C# class is placed in a folder named `UIThemeClasses` `UIThemeClasses/ThemeInfo.cs`: -```csharp -namespace BlazorSample.UIThemeClasses -{ - public class ThemeInfo - { - public string ButtonClass { get; set; } - } -} -``` +[!code-csharp[](~/blazor/samples/3.1/BlazorSample_WebAssembly/UIThemeClasses/ThemeInfo.cs)] The following [layout component](xref:blazor/components/layouts) specifies theme information (`ThemeInfo`) as a cascading value for all components that make up the layout body of the property. `ButtonClass` is assigned a value of [`btn-success`](https://getbootstrap.com/docs/5.0/components/buttons/), which is a Bootstrap button style. Any descendent component in the component hierarchy can use the `ButtonClass` property through the `ThemeInfo` cascading value.