Table of Contents

Class TwDatePickerCalendar

Namespace
TwBlazor.Components.DatePicker
Assembly
TwBlazor.dll

The reusable year/month/day calendar navigation - header, quick-pick grids, and day grid - shared by every popover date picker in the library (TwDatePicker, TwDateTimeRangePicker). Deliberately excludes the trigger textfield, popover open/close mechanics, and any time editor - those stay with each picker, which composes this purely for its calendar portion.

public class TwDatePickerCalendar : TwBlazorComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent
Inheritance
TwDatePickerCalendar
Implements
Inherited Members

Remarks

TwDateRangePicker is the one exception: its two-month, single shared-header layout doesn't decompose into one instance of this component, so it keeps its own (structurally similar but distinct) rendering.

Constructors

TwDatePickerCalendar()

public TwDatePickerCalendar()

Properties

AnchorDate

The month/year/decade currently displayed - a pure navigation position, independent of the actual selection (SelectedDate/Range). Browsing with the header's Previous/Next controls, or drilling through the quick-pick grids, only moves this; the real selection changes only when a day is actually clicked.

[Parameter]
[EditorRequired]
public DateTime AnchorDate { get; set; }

Property Value

DateTime

AnchorDateChanged

The bound AnchorDate value; invoked whenever navigation (Previous/Next, or a month/year quick-pick) moves it.

[Parameter]
public EventCallback<DateTime> AnchorDateChanged { get; set; }

Property Value

EventCallback<DateTime>

BodyClasses

Gets or sets the CSS class names to apply to the body element of whichever view is current.

[Parameter]
public string BodyClasses { get; set; }

Property Value

string

DaySelected

Invoked when a day is clicked in the day grid.

[Parameter]
[EditorRequired]
public EventCallback<DateTime> DaySelected { get; set; }

Property Value

EventCallback<DateTime>

MaxDate

The latest selectable date (inclusive). Days after this render disabled in the day grid, and the Next month button is disabled once it's reached. null (the default) leaves the upper bound unrestricted.

[Parameter]
public DateTime? MaxDate { get; set; }

Property Value

DateTime?

MinDate

The earliest selectable date (inclusive). Days before this render disabled in the day grid, and the Previous month button is disabled once it's reached. null (the default) leaves the lower bound unrestricted.

[Parameter]
public DateTime? MinDate { get; set; }

Property Value

DateTime?

Navigated

Invoked after any interaction that swaps out the panel's focusable content - a view switch, or a month/year quick-pick - so the host popover can reclaim focus inside its own panel element, mirroring the pendingViewFocus mechanic every popover picker in this library already used individually before this component existed.

[Parameter]
public EventCallback Navigated { get; set; }

Property Value

EventCallback

PreserveAnchorDay

Whether jumping to a different month/year (via the quick-pick grids) keeps AnchorDate's existing day and time-of-day, or resets both to the 1st at midnight. Default is true (keep them) - the right choice for a single-date picker, where the anchor is centered on a specific day. Pass false for a picker where the anchor only ever needs to identify a month, never a specific day.

[Parameter]
public bool PreserveAnchorDay { get; set; }

Property Value

bool

Range

When set, switches the day grid from single-day selection to range highlighting - forwarded directly to Range.

[Parameter]
public KeyValuePair<DateTime?, DateTime?>? Range { get; set; }

Property Value

KeyValuePair<DateTime?, DateTime?>?

SelectedDate

The reference date used to highlight a day (in single-select mode) or a month/year quick-pick button as selected. In range mode (Range set), pass whichever side of the range is relevant to the current step - the day grid itself renders both range endpoints independently of this.

[Parameter]
public DateTime? SelectedDate { get; set; }

Property Value

DateTime?

ShowMonthCaption

Forwarded to ShowMonthCaption - set by callers (like a range picker) that need each day grid to label its own month.

[Parameter]
public bool ShowMonthCaption { get; set; }

Property Value

bool

ShowTodayIndicator

Whether the month/year quick-pick grids mark the actual current year/month with ActiveClass, matching the day grid's own "today" indicator. Default is true.

[Parameter]
public bool ShowTodayIndicator { get; set; }

Property Value

bool

View

The currently displayed view (day grid, month quick-pick, or year quick-pick).

[Parameter]
public DatePickerCalendarView View { get; set; }

Property Value

DatePickerCalendarView

ViewChanged

The bound View value; invoked whenever the displayed view switches.

[Parameter]
public EventCallback<DatePickerCalendarView> ViewChanged { get; set; }

Property Value

EventCallback<DatePickerCalendarView>

Methods

BuildRenderTree(RenderTreeBuilder)

Renders the component to the supplied RenderTreeBuilder.

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder