Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

EventCallback as CascadingValue in Razor components using @Body?

$
0
0

I do not seem to be able to supply a callback from the parent component to the child, when teh child is rnedered using @Body:

<CascadingValue  Value="isGB"><CascadingValue Value="HandleChange">            @Body</CascadingValue></CascadingValue></div>@code {    private void HandleChange(bool isgb)    {        throw new Exception();        isGB = isgb;        StateHasChanged();    }}

What I ave in the child component:

    [CascadingParameter]    public EventCallback<bool> HandleChange { get; set; }    private async Task ChangeIsGB(bool isgb)    {        IsGB = isgb;        await HandleChange.InvokeAsync(isgb);    }

But the event does not fire, sadly enough. Why?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>