Skip to content

One way binding component parameter to source #48656

Answered by david-acker
danielchalmers asked this question in Q&A
Discussion options

You must be logged in to vote

I'm not super familar with Blazor or WPF, so I'm not sure if this is 100% equivalent, but you could use an EventCallback to notify the parent component when the component parameter is changed in the child.

Example from the docs: Binding with component parameters

[Parameter]
public int Year { get; set; }

[Parameter]
public EventCallback<int> YearChanged { get; set; }

private async Task UpdateYearFromChild()
{
    await YearChanged.InvokeAsync(r.Next(1950, 2021));
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by javiercn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area-blazor Includes: Blazor, Razor Components
2 participants