Search results

Open the DatePicker popup upon focusing input of DatePicker in Blazor DatePicker component

08 Apr 2021 / 1 minute to read

You can open the DatePicker popup on input focus by calling the show method in the input focus event.

The following example demonstrates how to open the DatePicker popup when the input is focused.

Copied to clipboard
@using Syncfusion.Blazor.Calendars

<SfDatePicker TValue="DateTime?" @ref="@DateObj">
    <DatePickerEvents TValue="DateTime?" Focus="FocusHandler"></DatePickerEvents>
</SfDatePicker>

@code{
    SfDatePicker<DateTime?> DateObj;
    public void FocusHandler(Syncfusion.Blazor.Calendars.FocusEventArgs args)    {
        this.DateObj.Show();
    }
}

The output will be as follows.

datepicker