From 692fb252b6cf7d0b6a5fcc41f4aae6a032beaaa7 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Sat, 22 Jun 2019 23:06:35 -0500 Subject: [PATCH] Components topic code example updates (#12893) --- .../3.x/BlazorSample/Components/HeadingComponent.razor | 2 +- .../Pages/CascadingValuesParametersTabSet.razor | 4 ++-- .../common/samples/3.x/BlazorSample/Pages/Index.razor | 2 +- aspnetcore/blazor/components.md | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/aspnetcore/blazor/common/samples/3.x/BlazorSample/Components/HeadingComponent.razor b/aspnetcore/blazor/common/samples/3.x/BlazorSample/Components/HeadingComponent.razor index 5efc3d9252..131f2eafc1 100644 --- a/aspnetcore/blazor/common/samples/3.x/BlazorSample/Components/HeadingComponent.razor +++ b/aspnetcore/blazor/common/samples/3.x/BlazorSample/Components/HeadingComponent.razor @@ -21,7 +21,7 @@ _italicsCheck field. *@ + @bind="_italicsCheck" /> diff --git a/aspnetcore/blazor/common/samples/3.x/BlazorSample/Pages/CascadingValuesParametersTabSet.razor b/aspnetcore/blazor/common/samples/3.x/BlazorSample/Pages/CascadingValuesParametersTabSet.razor index 0326960959..c2d348160c 100644 --- a/aspnetcore/blazor/common/samples/3.x/BlazorSample/Pages/CascadingValuesParametersTabSet.razor +++ b/aspnetcore/blazor/common/samples/3.x/BlazorSample/Pages/CascadingValuesParametersTabSet.razor @@ -8,7 +8,7 @@

Greetings from the first tab!

@@ -49,7 +49,7 @@ namespace BlazorSample.UIInterfaces <h4>Greetings from the first tab!</h4> <label> - <input type="checkbox" @@bind="@@showThirdTab" /> + <input type="checkbox" @@bind="showThirdTab" /> Toggle third tab </label> </Tab> diff --git a/aspnetcore/blazor/common/samples/3.x/BlazorSample/Pages/Index.razor b/aspnetcore/blazor/common/samples/3.x/BlazorSample/Pages/Index.razor index 2e0bd12f24..f2978781f1 100644 --- a/aspnetcore/blazor/common/samples/3.x/BlazorSample/Pages/Index.razor +++ b/aspnetcore/blazor/common/samples/3.x/BlazorSample/Pages/Index.razor @@ -40,7 +40,7 @@ @@* A check box sets the font style and is bound to the _italicsCheck field. *@@ - <input type="checkbox" id="italicsCheck" @@bind="@@_italicsCheck" /> + <input type="checkbox" id="italicsCheck" @@bind="_italicsCheck" /> <label class="form-check-label" for="italicsCheck">Use italics</label> </div> diff --git a/aspnetcore/blazor/components.md b/aspnetcore/blazor/components.md index f1c94b8296..07f1630d1f 100644 --- a/aspnetcore/blazor/components.md +++ b/aspnetcore/blazor/components.md @@ -5,7 +5,7 @@ description: Learn how to create and use Razor components, including how to bind monikerRange: '>= aspnetcore-3.0' ms.author: riande ms.custom: mvc -ms.date: 06/12/2019 +ms.date: 06/16/2019 uid: blazor/components --- # Create and use Razor components @@ -139,13 +139,13 @@ Using `@bind` with a `CurrentValue` property (``) When the component is rendered, the `value` of the input element comes from the `CurrentValue` property. When the user types in the text box, the `onchange` event is fired and the `CurrentValue` property is set to the changed value. In reality, the code generation is a little more complex because `@bind` handles a few cases where type conversions are performed. In principle, `@bind` associates the current value of an expression with a `value` attribute and handles changes using the registered handler. -In addition to `onchange`, the property can be bound using other events like `oninput` by adding a `@bind` attribute with an `event` parameter: +In addition to handling `onchange` events with `@bind` syntax, a property or field can be bound using other events by specifying an `@bind-value` attribute with an `event` parameter. The following example binds the `CurrentValue` property for the `oninput` event: ```cshtml - + ``` -Unlike `onchange`, `oninput` fires for every character that is input into the text box. +Unlike `onchange`, which fires when the element loses focus, `oninput` fires when the value of the text box changes. **Format strings**