Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Parameter] attribute on its own line #11970

Merged
merged 1 commit into from
Apr 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aspnetcore/client-side/spa/blazor/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Learn how to get started with Blazor by creating and modifying a Bl
monikerRange: '>= aspnetcore-3.0'
ms.author: riande
ms.custom: mvc
ms.date: 04/07/2019
ms.date: 04/14/2019
uid: spa/blazor/get-started
---
# Get started with Blazor
Expand Down Expand Up @@ -154,7 +154,7 @@ To add a parameter to the Counter component, update the component's `@functions`

*Pages/Counter.cshtml*:

[!code-cshtml[](get-started/samples_snapshot/3.x/Counter2.cshtml?highlight=4,8)]
[!code-cshtml[](get-started/samples_snapshot/3.x/Counter2.cshtml?highlight=4-5,9)]

Specify an `IncrementAmount` parameter in the Home component's `<Counter>` element using an attribute.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@functions {
private int currentCount = 0;

[Parameter] private int IncrementAmount { get; set; } = 1;
[Parameter]
private int IncrementAmount { get; set; } = 1;

private void IncrementCount()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
</ul>

@functions {
[Parameter] private RenderFragment<TItem> ItemTemplate { get; set; }
[Parameter] private IReadOnlyList<TItem> Items { get; set; }
[Parameter]
private RenderFragment<TItem> ItemTemplate { get; set; }

[Parameter]
private IReadOnlyList<TItem> Items { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@

@functions {
[CascadingParameter] private TabSet ContainerTabSet { get; set; }
[Parameter] private string Title { get; set; }
[Parameter] public RenderFragment ChildContent { get; private set; }

[Parameter]
private string Title { get; set; }

[Parameter]
public RenderFragment ChildContent { get; private set; }

private string TitleCssClass => ContainerTabSet.ActiveTab == this ? "active" : null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
</div>

@functions {
[Parameter] private RenderFragment ChildContent { get; set; }
[Parameter]
private RenderFragment ChildContent { get; set; }

public ITab ActiveTab { get; private set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@
</table>

@functions {
[Parameter] private RenderFragment TableHeader { get; set; }
[Parameter] private RenderFragment<TItem> RowTemplate { get; set; }
[Parameter] private RenderFragment TableFooter { get; set; }
[Parameter] private IReadOnlyList<TItem> Items { get; set; }
[Parameter]
private RenderFragment TableHeader { get; set; }

[Parameter]
private RenderFragment<TItem> RowTemplate { get; set; }

[Parameter]
private RenderFragment TableFooter { get; set; }

[Parameter]
private IReadOnlyList<TItem> Items { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ namespace BlazorSample.UIInterfaces
&lt;/div&gt;

@@functions {
[Parameter] private RenderFragment ChildContent { get; set; }
[Parameter]
private RenderFragment ChildContent { get; set; }

public ITab ActiveTab { get; private set; }

Expand Down Expand Up @@ -136,8 +137,12 @@ namespace BlazorSample.UIInterfaces

@@functions {
[CascadingParameter] private TabSet ContainerTabSet { get; set; }
[Parameter] private string Title { get; set; }
[Parameter] public RenderFragment ChildContent { get; private set; }

[Parameter]
private string Title { get; set; }

[Parameter]
public RenderFragment ChildContent { get; private set; }

private string TitleCssClass => ContainerTabSet.ActiveTab == this ? "active" : null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
</ul>

@functions {
[Parameter] private RenderFragment<TItem> ItemTemplate { get; set; }
[Parameter] private IReadOnlyList<TItem> Items { get; set; }
[Parameter]
private RenderFragment<TItem> ItemTemplate { get; set; }

[Parameter]
private IReadOnlyList<TItem> Items { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ namespace RazorComponents.UIInterfaces
&lt;/div&gt;

@@functions {
[Parameter] private RenderFragment ChildContent { get; set; }
[Parameter]
private RenderFragment ChildContent { get; set; }

public ITab ActiveTab { get; private set; }

Expand Down Expand Up @@ -136,8 +137,12 @@ namespace RazorComponents.UIInterfaces

@@functions {
[CascadingParameter] private TabSet ContainerTabSet { get; set; }
[Parameter] private string Title { get; set; }
[Parameter] public RenderFragment ChildContent { get; private set; }

[Parameter]
private string Title { get; set; }

[Parameter]
public RenderFragment ChildContent { get; private set; }

private string TitleCssClass => ContainerTabSet.ActiveTab == this ? "active" : null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@

@functions {
[CascadingParameter] private TabSet ContainerTabSet { get; set; }
[Parameter] private string Title { get; set; }
[Parameter] public RenderFragment ChildContent { get; private set; }

[Parameter]
private string Title { get; set; }

[Parameter]
public RenderFragment ChildContent { get; private set; }

private string TitleCssClass => ContainerTabSet.ActiveTab == this ? "active" : null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
</div>

@functions {
[Parameter] private RenderFragment ChildContent { get; set; }
[Parameter]
private RenderFragment ChildContent { get; set; }

public ITab ActiveTab { get; private set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@
</table>

@functions {
[Parameter] private RenderFragment TableHeader { get; set; }
[Parameter] private RenderFragment<TItem> RowTemplate { get; set; }
[Parameter] private RenderFragment TableFooter { get; set; }
[Parameter] private IReadOnlyList<TItem> Items { get; set; }
[Parameter]
private RenderFragment TableHeader { get; set; }

[Parameter]
private RenderFragment<TItem> RowTemplate { get; set; }

[Parameter]
private RenderFragment TableFooter { get; set; }

[Parameter]
private IReadOnlyList<TItem> Items { get; set; }
}
4 changes: 2 additions & 2 deletions aspnetcore/razor-components/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Learn how to get started with Razor Components by creating and modi
monikerRange: '>= aspnetcore-3.0'
ms.author: riande
ms.custom: mvc
ms.date: 04/07/2019
ms.date: 04/14/2019
uid: razor-components/get-started
---
# Get started with Razor Components
Expand Down Expand Up @@ -157,7 +157,7 @@ To add a parameter to the Counter component, update the component's `@functions`

*WebApplication1/Components/Pages/Counter.razor*:

[!code-cshtml[](get-started/samples_snapshot/3.x/Counter2.razor?highlight=4,8)]
[!code-cshtml[](get-started/samples_snapshot/3.x/Counter2.razor?highlight=4-5,9)]

Specify an `IncrementAmount` parameter in the Home component's `<Counter>` element using an attribute.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@functions {
private int currentCount = 0;

[Parameter] private int IncrementAmount { get; set; } = 1;
[Parameter]
private int IncrementAmount { get; set; } = 1;

private void IncrementCount()
{
Expand Down