Closed Dylan-DutchAndBold closed 3 years ago
Hi,
As far as I know, the purpose of @bind:event
syntax is to select exact DOM event on which the binding occurs (for example oninput
, onclick
etc.). This syntax doesn't make sense in this case.
The binding you're looking for should look like this:
<DateRangePicker StartDateChanged="SomeHandlerFunction" />
@code {
private void SomeHandlerFunction()
{
}
}
Oh I see, so it's like telling on what Parameter (of type EventCallback) of that component to bind the change handler? I got that quite twisted then. Thanks a lot for the sample. It's clear now.
Yes exactly. The example from their docs is a bit misleading. But the tricky part is that we cannot use @bind-Property
and PropertyChanged
at the same time, because @bind-
uses that PropertyChanged
handler under the hood.
Reading into the MS docs it seems that with two-way data binding I should be able to catch the triggering event instead of using
OnRangeSelect
. However when I try@bind-StartDate:event="SomeHandlerFunction"
nothing seems to happen.https://docs.microsoft.com/en-us/aspnet/core/blazor/components/data-binding?view=aspnetcore-5.0#binding-with-component-parameters