Open the Blazor DatePicker popup on Focus
13 Dec 20241 minute to read
You can open the DatePicker popup on input focus by calling the ShowPopupAsync
method in the input focus
event.
The following example demonstrates how to open the DatePicker popup when the input is focused.
@using Syncfusion.Blazor.Calendars
<SfDatePicker TValue="DateTime?" @ref="@DateObj">
<DatePickerEvents TValue="DateTime?" Focus="FocusHandler"></DatePickerEvents>
</SfDatePicker>
@code{
SfDatePicker<DateTime?> DateObj;
public async void FocusHandler(Syncfusion.Blazor.Calendars.FocusEventArgs args) {
await this.DateObj.ShowPopupAsync();
}
}
Open the Blazor DatePicker popup on Focus
You can also open the DatePicker popup on input focus by setting the OpenOnFocus property to true.
The following example demonstrates how to open the DatePicker popup when the input is focused.
@using Syncfusion.Blazor.Calendars
<SfDatePicker TValue="DateTime?" Placeholder="Choose a Date" OpenOnFocus="true" FullScreen="true" ShowClearButton="true"></SfDatePicker>