My situation is this: I'm trying to implement and Autocomplete.
The Autocomplete will have a Parameter
that will receive a string
and return a IEnumerable<TValue>
.
Here is an example of what I'm trying to do
Autocomplete.razor
@code {
[Parameter]
public SOME_TYPE GetItems { get; set; }
async void Foo(){
IEnumerable<TValue> items = await GetItems(SomeString);
// do something with items
}
}
ParentComponent.razor
<Autocomplete TValue="SomeEntity"
GetItems="@GetItems" />
@code {
SOME_TYPE GetItems(string name) {
IEnumerable<SomeEntity> entity = await GetEntitys(name);
return entity;
}
}
The problem is that I don't know what to put in SOME_TYPE
. Should I use EventCallback
? Action
? What should I use?
I tried using EventCallback
but looks like I can't get a return value from EventCallback
? I have no idea.