DateTimePicker
Description
This component represents a date and time picker in Blazor using the Gap.Blazor.DateTimePicker
model. It integrates with Telerik’s DatePicker
and optionally includes a checkbox to enable or disable the date selection. The component supports dynamic formatting and styling based on the model.
Usage
Properties
DateTimePicker: Instance of the
Gap.Blazor.DateTimePicker
model.Value: Bound to the selected date/time value.
Checked: Boolean indicating whether the date picker is enabled (used with
ShowCheckBox
).Format: Determines the display format of the date/time.
Methods
OnInitialized(): Subscribes to the
ValueChanged
event to trigger UI updates.DateTimePickerOnChange(): Invokes the model’s
PerformValueChange()
method.UpdateCheckedValue(): Automatically sets
Checked = true
when the calendar is opened.ConvertToTelerikFormat(): Converts the model’s format to a Telerik-compatible string:
Long
→"dddd, MMMM dd, yyyy"
Short
→"M/d/yyyy"
Time
→"h:mm tt"
Custom
→ UsesCustomFormat
from the model
Dynamic Rendering
The component dynamically renders a date picker with optional checkbox based on the DateTimePicker
model:
WMStyleBase: Applies styles based on the model.
TelerikCheckBox: Toggles the enabled state of the date picker.
TelerikDatePicker: Displays the date/time selection UI.
Styles
Layout: Uses
inline-flex
for alignment.Checkbox: Margins adjusted for visual alignment.
Input Styling: Font size and button width are model-driven.
Disabled State: When unchecked, the date picker is visually disabled using opacity and pointer restrictions.
Events
ValueChanged: Triggered when the selected date/time changes.
Last updated