Skip to content

Commit 3e09126

Browse files
committed
After stream
1 parent a745e85 commit 3e09126

File tree

11 files changed

+53
-17
lines changed

11 files changed

+53
-17
lines changed
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
<div class="card-body" style="color: @BodyFontColor">@ChildContent</div>
1+
<div class="card-body" style="@($"color: {BodyFontColor}; background-color: {BodyBgColor}")">@ChildContent</div>
22

33
@code {
44
[Parameter] public RenderFragment ChildContent { get; set; }
55

6-
[CascadingParameter(Name="bodyfontcolor")] public string BodyFontColor { get; set;} = "inherit";
6+
[CascadingParameter(Name="bodyfontcolor")] public string BodyFontColor { get; set; }
7+
[CascadingParameter(Name="bodybgcolor")] public string BodyBgColor { get; set; }
8+
9+
protected override void OnInitialized() {
10+
11+
Console.WriteLine($"BodyFontColor: {BodyFontColor}");
12+
base.OnInitialized();
13+
14+
}
15+
716

817
}

sessions/Season-03/0303-ComponentInteractions/src/Demo/Components/CardButton.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div>Here is a button: <button @onclick="OnClick">The Button</button></div>
1+
<div>Here is a button: <button @onclick="DoMoreWithClick">The Button</button></div>
22

33
@code {
44

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<p class="text-start">
2+
@ChildContent
3+
</p>
4+
5+
@code {
6+
7+
[Parameter] public RenderFragment ChildContent { get; set; }
8+
9+
}

sessions/Season-03/0303-ComponentInteractions/src/Demo/Components/TheCard.razor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
<CardHeader>@HeaderText</CardHeader>
44

5+
<CascadingValue Name="BodyBgColor" Value="@("lightGreen")">
56
<CardBody>@ChildContent</CardBody>
7+
</CascadingValue>
68

79
</div>
810

sessions/Season-03/0303-ComponentInteractions/src/Demo/Components/TheCardStyle.razor

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
<div class="card" @attributes="@Values">
1+
@using System.Collections.Generic
2+
3+
<div class="card" @attributes="Values">
4+
@* <div class="card" style="@(Values != null && Values.ContainsKey("style") ? Values["style"] : "")"> *@
25

36
<CardHeader>@HeaderText</CardHeader>
47

sessions/Season-03/0303-ComponentInteractions/src/Demo/Pages/2_Event.razor

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323

2424
public int Counter = 0;
2525
public string Text = string.Empty;
26-
void ButtonClicked() {
26+
void ButtonClicked(MouseEventArgs args) {
2727
Counter++;
28+
Console.WriteLine($"Shift button pressed: {args.ShiftKey}");
2829
}
2930

3031
void TextChanged(ChangeEventArgs args) {

sessions/Season-03/0303-ComponentInteractions/src/Demo/Pages/3_OtherAttributes.razor

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
<h1>Other Attributes and Parameters</h1>
44

5-
<TheCard HeaderText="Blazor Hat" style="text-decoration: underline;">
5+
<pre>
6+
&lt;TheCard HeaderText="Blazor Hat" style="text-decoration: underline;"&gt;
67
Another of Fritz's hats
7-
</TheCard>
8+
&lt;/TheCard&gt;
9+
</pre>
10+
11+
<TheCardStyle HeaderText="Blazor Hat">
12+
Another of Fritz's hats
13+
</TheCardStyle>

sessions/Season-03/0303-ComponentInteractions/src/Demo/Pages/4_Cascading.razor

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66
</p>
77

88
<pre>
9-
&lt;TheCard HeaderText="Blazor Hat"&gt;
10-
&lt;b&gt;Acquired:&lt;/b&gt; May 2020
11-
&lt;/TheCard&gt;
9+
&lt;CascadingValue Name="BodyFontColor" Value="@("red")"&gt;
10+
&lt;TheCard HeaderText="Blazor Hat"&gt;
11+
&lt;b&gt;Acquired:&lt;/b&gt; May 2020
12+
&lt;/TheCard&gt;
13+
&lt;/CascadingValue&gt;
1214
</pre>
1315

14-
<CascadingValue Name="BodyFontColor" Value="@("red")">
15-
<TheCard HeaderText="Blazor Hat">
16-
<b>Acquired:</b> May 2020
17-
</TheCard>
16+
<CascadingValue Name="BodyBgColor" Value="@("lightBlue")">
17+
<CascadingValue Name="BodyFontColor" Value="@("purple")">
18+
<TheCard HeaderText="Blazor Hat">
19+
<b>Acquired:</b> May 2020
20+
</TheCard>
21+
</CascadingValue>
1822
</CascadingValue>

sessions/Season-03/0303-ComponentInteractions/src/Demo/Pages/5_Session.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@page "/5_State"
2-
@* @inject State currentValue *@
2+
@inject State currentValue
33

44
<h1>Managing State Between Pages</h1>
55

@@ -9,7 +9,7 @@ This is a counter: <span>@currentValue.CurrentCount</span>
99

1010
@code {
1111

12-
State currentValue = new State();
12+
@* State currentValue = new State(); *@
1313

1414
void Increment() {
1515

sessions/Season-03/0303-ComponentInteractions/src/Demo/Pages/Index.razor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
<li><a href="/4_Cascading">Cascading Parameters</a></li>
1010
<li><a href="/5_State">Session State</a></li>
1111
</ol>
12+
13+
<Textbox>This is my textbox for r_shiyaa</Textbox>

0 commit comments

Comments
 (0)