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

How to create an Eventcallback which has the arguments in blazor?

$
0
0

I need to create a Eventcallback for this following method

public async Task methodA(bool isLoading){    IsLoading = isLoading;    this.StateHasChanged();    await Task.CompletedTask;}

I've tried it using following

EventCallback callback=> EventCallback.Factory.Create(this, methodA);

but I am getting a error called

can't convert method group to EventCallback

I need to create this event callback and pass it to the child components using cascading parameters as following

<CascadingValue Value=callback>    @Body</CascadingValue>    @code{      EventCallback callback=> EventCallback.Factory.Create(this, methodA);      public async Task methodA(bool isLoading)     {       IsLoading = isLoading;       this.StateHasChanged();       await Task.CompletedTask;     }   }

so what is wrong with above code ??and how to create an eventcallback for above method?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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