Dear Syncfusion team,
thank you for this great component.
I can open a DatePicker once I click on the calendar icon. How can I open a DatePicker by clicking on the component's field?
Since AllowEdit is set to False (field is not editable), users keep clicking on the field and expect DatePicker to show up.
This is my DatePickerCode:
<SfDatePicker TValue="DateTime" @bind-Value="@DueDate" AllowEdit="false" Min="DateTime.Now">
</SfDatePicker>
Best wishes,
Aleksandar
<SfDatePicker TValue="DateTime?" Placeholder='Choose a Date' @ref="dateObj" AllowEdit="false">
<DatePickerEvents TValue="DateTime?" Focus="@FocusHandler"></DatePickerEvents>
</SfDatePicker>
@code{
SfDatePicker<DateTime?> dateObj;
public void FocusHandler()
{
this.dateObj.ShowPopupAsync();
}
} |
Thank you, this works fine!
Since I have many date pickers it would be great if I could eliminate additional functions and code. This is what I came up with so far Focus="@(() => dateObj.ShowPopupAsync())":
<SfDatePicker TValue="DateTime?" Placeholder='Choose a Date' @ref="dateObj" AllowEdit="false">
<DatePickerEvents TValue="DateTime?" Focus="@(() => dateObj.ShowPopupAsync())"></DatePickerEvents>
</SfDatePicker>
@code{
SfDatePicker<DateTime?> dateObj;
}
Is it possible to to eliminate the need for @ref="dateObj" and SfDatePicker
<SfDatePicker TValue="DateTime?" Placeholder='Choose a Date' AllowEdit="false">
<DatePickerEvents TValue="DateTime?" Focus="@(() => this.ShowPopupAsync())"></DatePickerEvents>
</SfDatePicker>
Best wishes,
Aleksandar
<SfDatePicker TValue="DateTime?" Placeholder='Choose a Date' @ref="dateObj" AllowEdit="false">
<DatePickerEvents TValue="DateTime?" Focus="@(() => this.dateObj.ShowPopupAsync())"></DatePickerEvents>
</SfDatePicker>
@code{
SfDatePicker<DateTime?> dateObj;
} |