Date Range Picker
A date field that picks a start and an end date from one calendar.
Installation
bash
shellui-native add date-range-picker
Platforms: MAUI · Avalonia. Also installs icon, calendar.
Usage
Basic
<ui:DateRangePicker StartDate="{Binding From}" EndDate="{Binding To}" RangeChanged="OnRangeChanged" /><ui:DateRangePicker StartDate="{Binding From}" EndDate="{Binding To}" RangeChanged="OnRangeChanged" />Not available on yet
The first pick is the start and the second the end. A pick before the start, or one made when the range is already complete, starts over. The panel closes when the range is complete, and the × clears it.
Highlighting a range in a Calendar
The picker uses Calendar's RangeStart and RangeEnd, which tint a span of days. You can set them on a calendar of your own:
xml
<ui:Calendar RangeStart="{Binding From}" RangeEnd="{Binding To}" />
MAUI and Avalonia
On Avalonia the focused trigger also opens with Enter, Space or Down, and Escape closes the panel.
API
| Property | Type | Default | Description |
|---|---|---|---|
StartDate |
DateTime? |
null |
First day of the range; null until one is picked. Two-way bindable. |
EndDate |
DateTime? |
null |
Last day of the range; null until the range is complete. Two-way bindable. |
Placeholder |
string |
"Pick a date range" |
Hint shown while empty. |
Format |
string |
"MMM d, yyyy" |
.NET date format string for the trigger text. |
AllowClear |
bool |
true |
Shows the × that clears the range. |
MinimumDate |
DateTime? |
null |
Earliest selectable date; null for no limit. |
MaximumDate |
DateTime? |
null |
Latest selectable date; null for no limit. |
| Event | Arguments | Description |
|---|---|---|
RangeChanged |
— | StartDate or EndDate changed. |
| Method | Description |
|---|---|
SetOpen(bool open) |
Opens or closes it. |
Close() |
Closes it. |
Clear() |
Clears both dates. |